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:
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#
- Controller and lifecycle: drafts, baseline, reset, submit, disposal, and snapshots.
- Field handles: typed refs, visibility, readonly state, and writes.
- Validation and visibility: resolver scopes and error display modes.
- Async validation and server errors.
- List operations and relations.
- Form State API: compact member index.