Overview
Zard on pub.dev
Zard is a powerful and expressive schema validation and transformation library for Dart, inspired by the Zod library from the JavaScript ecosystem.
Zard makes it easy to define strict validation rules for your Dart objects using an intuitive and chainable API.
Whether you’re building Flutter apps, working with APIs, or validating user input, Zard provides the tools you need to ensure your data is clean and reliable — both synchronously and asynchronously.
✨ Features
- Fully typed schema definitions.
- Synchronous and asynchronous parsing (parse, safeParse, parseAsync, safeParseAsync).
- Detailed and structured error reporting.
- Chainable validations (e.g., .min(), .max(), .email()).
- Deep validations for maps and lists.
- Custom validation with refine() for complex logic.
- Inspired by Zod, tailored for Dart and Flutter.
🚀 Quick Example
import 'package:zard/zard.dart';
final schema = z.string().min(3).email(message: "Invalid email");
final result = schema.safeParse("hi@zard.dev");
if (result['success']) {
print("✅ Valid: ${result.data}");
} else {
print("❌ Errors: ${result.error}");
}
📦 Installation
dependencies:
zard: ^0.0.13
Then, install:
dart pub get
# or
dart pub add zard
❤️ Support
If you find Zard helpful, please consider supporting its development:
Made with ❤️ for Dart & Flutter developers.
Last updated on