Overview
Zema plugins are separate packages that build on top of package:zema. Each plugin targets one integration layer. The core library has no Flutter, plugins add those.
Available plugins
zema_forms
Bind schemas to Flutter form widgets. ZemaFormController manages per-field validation state and exposes per-field error notifiers so only the field in error rebuilds.
final ctrl = ZemaFormController(schema: loginSchema);
Package: packages/zema_forms: reference
zema_firestore
Validate Cloud Firestore documents via withConverter. Every read is validated, every write converts DateTime to Timestamp. Uses withZema() on CollectionReference, DocumentReference, and Query.
final usersRef = db.collection('users').withZema(userSchema);
Package: packages/zema_firestore: reference
zema_hive
Validate Hive documents on read and write. No TypeAdapter, no code generation. Uses withZema() on Box. Supports a migrate callback for schema evolution.
final userBox = box.withZema(userSchema);
Package: packages/zema_hive: reference
Design principles
All plugins follow the same rules:
- The plugin depends on
package:zema.package:zemanever depends on the plugin. - Schemas defined in the core library work unchanged in every plugin.
- Plugins add adapters or widgets. They do not re-implement validation logic.
- Each plugin ships its own
pubspec.yamland lives underpackages/.
Installing a plugin
Plugins are independent pub packages. Add only what you use:
dependencies:
zema: ^0.5.0
zema_forms: ^0.1.0 # Flutter form integration
zema_firestore: ^0.1.0 # Firestore integration
zema_hive: ^0.1.0 # Hive integration
Core-only projects (non-Flutter, pure Dart) depend only on zema.