FormStateNotifier<Success, Failure extends Error> class
abstract
A class to manage form state, extending a notifier to notify its subscribers of changes, and using the FormController mixin for form operations.
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.
Constructors
- FormStateNotifier.new({bool stopOnFirstError = false})
- Constructor for FormStateNotifier, defaults to not stopping at the first error.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
ref
→ NotifierProviderRef<
BondFormState< Success, Failure> > -
The
Ref
from the provider associated with thisNotifier
.no setterinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
state
↔ BondFormState<
Success, Failure> -
Gets the current state of the form.
getter/setter pair
-
stateOrNull
→ BondFormState<
Success, Failure> ? -
The value currently exposed by this
Notifier
.no setterinherited - stopOnFirstError ↔ bool
-
Determines whether the validation should stop at the first error.
finalgetter/setter pairinherited-setter
Methods
-
addFieldListener<
T> (String fieldName, void listener(T)) → void -
Add a listener for a specific field's changes and returns the current field value
inherited
-
build(
) → BondFormState< Success, Failure> - Builds the initial state for the form.
-
clear(
) → void -
Clears the form state and resets it to its initial pristine state.
inherited
-
dispose(
) → void -
Disposes resources used by the form controller.
inherited
-
disposeTracking(
) → void -
Cleans up tracking resources
inherited
-
fields(
) → Map< String, FormFieldState> -
Returns the map of field names to their corresponding
FormFieldState
.inherited -
initializeFieldTracking(
) → void -
Initialize field tracking for change detection
inherited
-
listenSelf(
void listener(BondFormState< Success, Failure> ? previous, BondFormState<Success, Failure> next), {void onError(Object error, StackTrace stackTrace)?}) → void -
Listens to changes on the value exposed by this provider.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyFieldListeners<
T> (String field, T value) → void -
Called when a field is updated to notify any registered listeners
inherited
-
onFailure(
Failure error) → void -
Called when form submission fails. Can be overridden.
inherited
-
onSubmit(
) → Future< Success> - An abstract method to be implemented by the subclass, detailing what should happen when the form is submitted.
-
onSuccess(
Success result) → void -
Called when the form is successfully submitted. Can be overridden.
inherited
-
removeFieldListener<
T> (String fieldName, void listener(T)) → void -
Remove a listener for a specific field's changes
inherited
-
resetInitialFieldsValue(
) → void -
resets the initial field values
inherited
-
setError(
String fieldName, String error) → void -
Sets an error message for the specified field and updates the form state to invalid.
inherited
-
submit(
) → Future< void> -
Initiates the form submission process.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
updateError(
String fieldName, String error) → void -
Updates the error message for the specified field and performs additional validation.
inherited
-
updateShouldNotify(
BondFormState< Success, Failure> previous, BondFormState<Success, Failure> next) → bool -
A method invoked when the state exposed by this
Notifier
changes. It compares the previous and new value, and return whether listeners should be notified.inherited -
updateValue<
T extends FormFieldState< (G> , G>String fieldName, G value) → void -
Updates the field value and notifies any registered listeners
inherited
-
validate(
) → void -
Validates all fields in the form.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited