FormFieldState<T> class abstract

Represents the state of a form field.

A form field can have a generic type T for its value. such as the current value, error message, label, validation rules, and whether it has been touched or should validate on updates.

Implementers

Constructors

FormFieldState({required T value, String? error, required String label, bool touched = false, bool validateOnUpdate = false, List<ValidationRule<T>> rules = const []})
Creates a new instance of FormFieldState.

Properties

error → String?
The error message associated with the form field, if any.
final
hashCode → int
The hash code for this object.
no setteroverride
label → String
The label or name of the form field.
final
rules → List<ValidationRule<T>>
The list of validation rules to apply to the form field.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
touched → bool
Indicates whether the form field has been touched (interacted with) by the user.
final
validateOnUpdate → bool
Indicates whether validation should occur when the form field is updated.
final
value → T
The current value of the form field.
final

Methods

copyWith({T? value, String? error, String? label, bool? touched, bool? validateOnUpdate, List<ValidationRule<T>>? rules}) → FormFieldState<T>
Creates a new FormFieldState object by copying the existing state and replacing the specified fields with new values.
copyWithNullable({T? value}) → FormFieldState<T>
A null-tolerant version of copyWith, allowing you to explicitly set fields to null.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
updateError(String? error) → FormFieldState<T>
Updates the error field for the FormFieldState.
validate(Map<String, FormFieldState> fields) → String?
Validates the form field against its validation rules.

Operators

operator ==(Object other) → bool
The equality operator.
override