FormFieldsController<E extends Enum> class
A controller that manages form field states and validation
- Available extensions
Constructors
-
FormFieldsController(FormKey key, {Map<
E, FieldConfig> ? validators, bool focusOnInvalid = false, bool autoScrollWhenFocusOnInvalid = false}) - Creates a FormFieldsController.
Properties
- autoScrollWhenFocusOnInvalid → bool
-
Whether validate scrolls the first invalid field into view by
default, when focusOnInvalid (or its per-call override) is
true.final - focusOnInvalid → bool
-
Whether validate moves focus to the first invalid field by default.
final
- hasBeenInteracted → bool
-
Check if the form has been interacted with.
no setter
- hasChanged → bool
-
Check if the form has changed.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → FormKey
-
The form key.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clearForcedErrors(
{bool notify = true}) → void - Clear the forced errors.
-
dispose(
) → void - Dispose of all resources.
-
fieldKey(
E field) → GlobalKey< FormFieldState> - Get or create a GlobalKey for a form field
-
fieldListenable(
E field) → Listenable -
Returns a Listenable that fires when
field's value changes. -
focusNodeFor(
E field, {FocusNode? external}) → FocusNode -
Returns the FocusNode used to focus
fieldwhen validation fails with focusOnInvalid enabled. -
getFieldError(
E field) → String? - Get the error of a form field.
-
getFieldForcedError(
E field) → String? - Get the forced error of a form field.
-
getInitialValue<
T extends Object?> (E field) → T? - Get the initial value of a form field.
-
getNotifier<
T extends Object?> (E field) → ValueListenable< T?> -
Returns a read-only ValueListenable for
field. -
getValue<
T> (E field) → T? - Get the value of a form field.
-
getValues(
) → Map< E, dynamic> - Get the values of the form fields.
-
hasFieldError(
E field) → bool - Check if a form field has an error.
-
isAllDirty(
) → bool - Check if all form fields have been interacted with.
-
isDirty(
Set< E> fields) → bool - Check if the form fields have been interacted with.
-
listen<
R> (Set< E> fields, R selector(T? get<T>(E field) )) → R -
Available on FormFieldsController<
Listens to changes on the specifiedE> , provided by the FormListenerExtension extensionfieldsand rebuilds the widget when any of their values change. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
) → void - Reset the form.
-
save(
) → void - Save the form.
-
setError(
E field, String error, {bool notify = true}) → void - Set the error of a form field.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateValue<
T> (E field, T? value, {bool notify = true}) → T? - Update the value of a form field.
-
validate(
{bool notify = true, bool clearErrors = true, bool? focusOnInvalid, bool? autoScrollWhenFocusOnInvalid}) → bool - Validate the form.
-
validateField(
E field) → bool - Validate the form field.
-
validators(
E field) → List< Validator> ? -
Get the validators of a form field. Use
localizeto localize the validators.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited