FormController<Success, Failure extends Error> mixin
A mixin to manage the state and logic of a form.
The mixin defines methods for updating fields, validating the form, and handling form submission.
Type Parameters:
Success
: The data type that represents the result of a successful form submission.Failure
: The error type that extends Error representing the failure cases of form submission.
- Mixin applications
- Available extensions
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
state
↔ BondFormState<
Success, Failure> -
Returns the current state of the form.
getter/setter pair
- stopOnFirstError ↔ bool
-
A flag indicating if the validation should stop on encountering the first error.
getter/setter pair
Methods
-
clear(
) → void - Clears the form state and resets it to its initial pristine state.
-
fields(
) → Map< String, FormFieldState> -
Returns the map of field names to their corresponding
FormFieldState
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onSubmit(
) → Future< Success> - To be implemented by the subclass, detailing what should happen when a form is submitted.
-
setError(
String fieldName, String error) → void - Sets an error message for the specified field and updates the form state to invalid.
-
submit(
) → Future< void> - Initiates the form submission process.
-
toggleCheckbox<
T> (String fieldName, {required T value, bool? selected}) → void -
Available on FormController<
Toggles the value of a specific checkbox within a checkbox group.dynamic, Error> , provided by the XFormController extension -
toString(
) → String -
A string representation of this object.
inherited
-
update<
T extends FormFieldState< (G> , G>String fieldName, G value) → void - Updates the field value and status.
-
updateAsyncDropDown<
T> (String fieldName, T value) → void -
Available on FormController<
Updates a AsyncDropDownFieldState with a givendynamic, Error> , provided by the XFormController extensionvalue
. -
updateCheckbox(
String fieldName, bool value) → void -
Available on FormController<
Updates a CheckboxFieldState with a givendynamic, Error> , provided by the XFormController extensionvalue
. -
updateCheckboxGroup<
T> (String fieldName, Set< T> value) → void -
Available on FormController<
Updates a CheckboxGroupFieldState with a givendynamic, Error> , provided by the XFormController extensionvalue
. -
updateDate(
String fieldName, DateTime? value) → void -
Available on FormController<
Updates a DateFieldState with a givendynamic, Error> , provided by the XFormController extensionvalue
. -
updateDropDown<
T> (String fieldName, T value) → void -
Available on FormController<
Updates a DropDownFieldState with a givendynamic, Error> , provided by the XFormController extensionvalue
. -
updateError(
String fieldName, String error) → void - Updates the error message for the specified field and performs additional validation.
-
updateFile(
String fieldName, File? value) → void -
Available on FormController<
Updates a FileFieldState with a givendynamic, Error> , provided by the XFormController extensionvalue
. -
updateHiddenField<
T> (String fieldName, T value) → void -
Available on FormController<
Updates a HiddenFieldState with a givendynamic, Error> , provided by the XFormController extensionvalue
. -
updateRadioButton<
T> (String fieldName, T value) → void -
Available on FormController<
Updates a RadioButtonFieldState with a givendynamic, Error> , provided by the XFormController extensionvalue
. -
updateRadioGroup<
T> (String fieldName, T value) → void -
Available on FormController<
Updates a RadioGroupFieldState with a givendynamic, Error> , provided by the XFormController extensionvalue
. -
updateText(
String fieldName, String? value) → void -
Available on FormController<
Updates a TextFieldState with a givendynamic, Error> , provided by the XFormController extensionvalue
. -
validate(
) → void - Validates all fields in the form.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited