Installation
Setting up ZodArt is quick and easy:
âšī¸ Optional: Even though using code generation is HIGHLY recomended (see why code generation), ZodArt can work without it. If you really don't want to use code generation for some reason, only Add ZodArt package.
- Add ZodArt package
- Add build_runner package
- Use ZodArt annotations
- đ Recommended: Install ZodArt snippets extension
Add ZodArt packageâ
Add ZodArt package to your dependencies:
For Flutter project:
flutter pub add zodart
For Dart project:
dart pub add zodart
Add build_runner packageâ
Add build_runner package to your dependencies:
For Flutter project:
flutter pub add dev:build_runner
For Dart project:
dart pub add dev:build_runner
Use ZodArt annotationsâ
-
Add a
partdirective into your code to include the generated code:import 'package:zodart/zodart.dart';
// MANDATORY
// Add part '<your_file_name.zodart.dart>'; so for 'code_gen_example.dart' add:
part 'code_gen_example.zodart.dart';
// MANDATORY when generating output class
// Add part '<your_file_name.zodart.type.dart>'; so for 'code_gen_example.dart' add:
part 'code_gen_example.zodart.type.dart';
/// your code using `@ZodArt` annotation follows -
Run
build_runnerto generate the ZodArt helper / output classesdart run build_runner build
đ Recommended: Install ZodArt snippets extension for VS Codeâ
To simplify the schema creation use the official ZodArt Snippets extension for VS Code.

Linksâ
đ See the full working example.