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.
dart pub add acanthisflutter pub add acanthisImport the library wherever you define a schema:
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.
final email = string().email();
final result = email.tryParse('ada@example.com');
print(result.success); // true
print(result.value); // ada@example.comSchema 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
- Custom rules for application-specific checks, including async work.
- Transformations for converting input into the output you need.
- JSON Schema and OpenAPI exports for supported schemas.
- Seeded mocking for reproducible test data within a documented supported subset.
