axion 1.0.0 copy "axion: ^1.0.0" to clipboard
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);
  }
}
0
likes
160
points
35
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A lightweight, Zod-inspired, type-safe validation library for Dart with fluent API, coercion, transformations, async refinements, and i18n support.

Repository (GitHub)

License

MIT (license)

Dependencies

path, phone_numbers_parser

More

Packages that depend on axion