Skip to content
pubscout

ack

1.7.1, released 2 weeks ago by leoafarias.com

Schema validation library with bidirectional codecs and JSON Schema support.

WASM-ready
$ flutter pub add ack
Source repository

What it does

Ack provides schema validation and bidirectional codecs for Dart and Flutter. It allows developers to define validation rules using a fluent API, validate external payloads against schemas, import and export JSON Schemas, and generate immutable models.

AI-written summary of version 1.7.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to validate incoming API payloads and user inputs against structured rules.
  • You want bidirectional codecs that handle both parsing and serialization in a single definition.
  • You need to import or export JSON Schema definitions in your Dart/Flutter applications.

Skip it when

  • You are already heavily invested in built_value or json_serializable for your serialization needs and do not want to migrate.
  • You only need simple state management or dependency injection.

Strengths

  • Fluent, easy-to-read API for defining complex data validation logic.
  • Built-in JSON Schema import and export support.
  • Reduces boilerplate for validation and JSON conversion.

Weaknesses

  • Requires migrating away from other annotation systems if you adopt its built-in code generation via `@Schemable()`.
  • Full A2UI coverage is not supported.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
2

Add ack to pubspec.yaml and import 'package:ack/ack.dart'.

import 'package:ack/ack.dart';

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

final result = userSchema.safeParse({
  'name': 'John Doe',
  'email': 'john@example.com',
  'age': 30,
});

Alternatives

Packages that do the same job and could replace ack.

  • json_serializable

    If you prefer standard annotation-based JSON serialization without custom schema validation logic.

  • freezed

    If your primary goal is generating immutable union types and data classes with built-in copyWith and equality.