FormField<T> class

A single form field that manages its own value, validation, and saving.

Supply a builder callback that returns the visual widget tree, using FormFieldState to access the current value and error state.

Inheritance

Constructors

FormField({Key? key, required T initialValue, String? validator(T?)?, void onSaved(T)?, required Widget builder(FormFieldState<T>)})
Creates a FormField with the given initialValue and optional validator.
const

Properties

builder Widget Function(FormFieldState<T>)
Builds the visual representation using the current field state.
final
hashCode int
The hash code for this object.
no setterinherited
initialValue → T
The starting value of the field.
final
key Key?
Controls how one widget replaces another in the tree.
finalinherited
onSaved → void Function(T)?
Called when the parent Form is saved.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
validator String? Function(T?)?
An optional validation function that returns an error string or null.
final

Methods

createElement() StatefulElement
Creates the Element for this widget.
inherited
createState() State<FormField<T>>
Creates the mutable state for this widget.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited