axion 1.0.0
axion: ^1.0.0 copied to clipboard
A lightweight, Zod-inspired, type-safe validation library for Dart with fluent API, coercion, transformations, async refinements, and i18n support.
example/example.dart
import 'package:axion/axion.dart';
void main() {
configureAxion((config) {
config.translations = axionTranslationsEn;
});
final schema = object({
'name': string().min(2).max(50),
'email': string().email(),
'age': integer().min(0).max(120),
'phone': string().phone({'US'}),
}).strict();
try {
final valid = schema.parse({
'email': 'alice@example.com',
'age': 30,
'phone': '6505551234',
});
print(valid);
} on AxionException catch (e) {
print(e.asMap);
}
}