Skip to main content

ack 2.0.0-beta.4 copy "ack: ^2.0.0-beta.4" to clipboard
ack: ^2.0.0-beta.4 copied to clipboard

Schema validation and bidirectional codecs for Dart and Flutter

Ack #

pub package CI Documentation

Ack is a schema validation library for Dart and Flutter. Ack is short for "acknowledge".

Install #

dart pub add ack:^2.0.0-beta.4

Example #

import 'package:ack/ack.dart';

final userSchema = Ack.object({
  'name': Ack.string().minLength(2).maxLength(50),
  'age': Ack.integer().min(0).max(120),
  'email': Ack.string().email().nullable(),
});

final result = userSchema.safeParse({
  'name': 'Ada',
  'age': 36,
  'email': 'ada@example.com',
});

if (result.isOk) {
  print('Welcome, ${result.getOrThrow()!['name']}');
} else {
  print(result.getError()); // one path: message line per failure
}

Learn more #

58
likes
160
points
6.07k
downloads

Documentation

API reference

Publisher

verified publisherleoafarias.com

Weekly Downloads

Schema validation and bidirectional codecs for Dart and Flutter

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#validation #schema #json-schema #codec #serialization

License

BSD-3-Clause (license)

Dependencies

collection, meta

More

Packages that depend on ack