Skip to content
pubscout

zard

1.4.0, released 4 months ago by evandersondev.com.br

Schema validation and transformation library for Dart, inspired by Zod

$ flutter pub add zard
Source repository

What it does

Zard provides a schema definition, validation, and transformation library for Dart. It supports standard types, complex nested objects, custom refinements, asynchronous validations, and performance-optimized validation checks.

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

Use it when

  • You need to validate complex data structures or API payloads in Dart or Flutter.
  • You want Zod-like schema validation semantics in your Dart applications.

Skip it when

  • You need compile-time code generation for immutable models rather than runtime validation.

Strengths

  • Extensive built-in string, numeric, list, and map validators including ISO dates and network types.
  • High performance that meets or beats Zod on many operations.
  • Supports both throwing and non-throwing parse APIs along with async refinements.

Weaknesses

  • Closure-only constraints like custom refinements cannot be introspected for static schema exporting.
  • Slightly slower than V8 on complex nested objects due to Dart VM limitations.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
1

Add zard to dependencies in pubspec.yaml and import package:zard/zard.dart.

import 'package:zard/zard.dart';

void main() {
  final schema = z.string().min(3).email();
  final result = schema.safeParse('example@example.com');
  if (result.success) {
    print(result.data);
  }
}

Alternatives

Packages that do the same job and could replace zard.

  • luthor

    A Dart validation library inspired by Zod with optional code generation support.

  • ack

    Schema validation library with bidirectional codecs and JSON Schema support.

  • acanthis

    A type-safe and composable data validation library for Dart and Flutter.

  • ez_validator

    Dead‑simple field and object schema validation for Flutter.

Works with

Packages commonly used together with zard: ones it builds on, ones built on it, and its own family.