Skip to content

Validate data with Acanthis

Acanthis is a schema validation library for Dart and Flutter. Describe the data you expect, validate input at runtime, and use the result in your application.

Use it for form fields, API payloads, configuration, or any other data entering your application. Its chainable API is inspired by Zod.

Installation

Version scope

These docs describe the 2.0 codebase, which requires Dart 3.13 or later. Flutter projects need a Flutter SDK with a compatible Dart version. See the migration guide when upgrading from 1.x; check pub.dev for published releases.

sh
dart pub add acanthis
sh
flutter pub add acanthis

Import the library wherever you define a schema:

dart
import 'package:acanthis/acanthis.dart';

The core idea

A schema combines a type with checks. Parsing applies those checks to an input and returns a result.

dart
final email = string().email();
final result = email.tryParse('ada@example.com');

print(result.success); // true
print(result.value); // ada@example.com

Schema methods return new instances, so you can reuse a base schema and extend its checks. Successful validation can preserve input identity; it does not guarantee a deep copy. See input sharing in 2.0.

Choose your next step

More than validation

Built by Avesbox · Made for Dart & Flutter