Schema reference
Start with a type, then chain checks and transformations. Each method returns a new schema, so you can reuse a base schema without changing it.
dart
final email = string().email();
final account = object({'email': email});New to Acanthis? Follow the quick start for a complete example.
StringsValidate text, check formats, and transform string values.Numbers, booleans, and datesChoose a primitive schema and add the constraints your data needs.ObjectsValidate named fields, control unknown keys, and compose reusable object schemas.Lists and tuplesValidate repeated values with lists or fixed positions with tuples.Nullable valuesAllow null explicitly and distinguish it from an absent object field.Instances and classesValidate existing Dart instances and describe class fields.Literals and unionsMatch exact values or accept one of several schema shapes.Custom validationAdd synchronous or asynchronous rules when built-in checks are not enough.Transformations and defaultsConvert input values, chain schemas, and provide recovery defaults.Mock dataGenerate sample input and choose between legacy mocking and bounded seeded generation.
Find a specific type or operation
| Type or operation | Reference |
|---|---|
| String | View guide |
| String Formats | View guide |
| Emails | View guide |
| Numeric values | View guide |
| Booleans | View guide |
| Dates | View guide |
| Nullables | View guide |
| Objects | View guide |
extend() | View guide |
merge() | View guide |
pick() | View guide |
omit() | View guide |
partial() | View guide |
| Recursive Objects | View guide |
| Lists | View guide |
| Instances | View guide |
Differences to object() | View guide |
| Cross-field validation with refs | View guide |
| Class Schemas | View guide |
| Tuples | View guide |
variadic() | View guide |
| Literals | View guide |
| Union | View guide |
variant() | View guide |
| Refinements | View guide |
refine() | View guide |
refineAsync() | View guide |
| Pipes | View guide |
| Default Values | View guide |
| Template Literals | View guide |
| Mocking schemas | View guide |
| Type Coercion | View guide |
coerce() and Unions | View guide |
| Seeded test data | View guide |
