keyed_form

Form State

Manage immutable drafts, typed fields, validation, and collection identity in pure Dart.

keyed_form is the pure-Dart state layer: a controller owns a typed draft, baseline, keyed errors, and lifecycle state independently of any widget tree. Generated refs make reads and writes address the same stable field identity. Flutter bindings are a separate layer; see Flutter.

A minimal generated-model setup looks like this:

dart
final form = KeyedFormController<InvoiceSchema>(
  initialValue: InvoiceSchema.create(),
  mode: KeyedFormMode.onTouched,
  resolver: (draft, scope) => InvoiceSchema.validateData(draft, scope: scope),
  scopeOf: InvoiceSchema.scopeOf,
);
form.field(InvoiceFields.customerEmail).set('ada@example.com');

Generated models and validators are described in Schema; controller lifecycle and field access begin with Controller and lifecycle and Field handles. For framework bindings see Flutter.

Explore Form State#