LoFormState<TKey> class

Inheritance

Constructors

LoFormState({ValMap<TKey>? initialValues, List<LoFormBaseValidator<TKey>> validators = const [], SubmitFunc<TKey>? onSubmit, ValueChanged<LoFormState<TKey>>? onChanged, StatusCheckFunc? submittableWhen})

Properties

fields FieldsMap<TKey>
Map between LoField.loKey and their LoFieldState.
final
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
initialValues ValMap<TKey>?
Map between LoField.loKey and their initial value.
final
onChanged ValueChanged<LoFormState<TKey>>?
Callback function that gets executed when any field or status are changed.
final
onSubmit SubmitFunc<TKey>?
Callback function that gets executed when LoFormState.submit is called with fields' values as first parameter and setError function as second one which is used to set external API errors.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status LoStatus
Current form status, LoStatusX.and method is used to evaluate this.
getter/setter pair
submit → (Future<void> Function()?)
Returns the handleSubmit method if submittableWhen is null or true, otherwise returns null.
no setter
submittableWhen StatusCheckFunc?
Predicate that defines when the form can be submitted.
final
validators List<LoFormBaseValidator<TKey>>
List of the validators to run on each change.
final

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
override
handleSubmit() Future<void>
Submits form using the current values and calls onSubmit, modifies status based on the result.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
override
onFieldFocusChanged<TValue>(TKey loKey, bool isFocused) → void
onFieldValueChanged<T>(TKey loKey, T? value) → void
registerField<TValue>({required TKey loKey, TValue? initialValue, required List<LoFieldBaseValidator<TValue>>? validators, Duration? debounceTime}) → void
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
setErrors(ErrMap<TKey>? map) → void
toString() String
A string representation of this object.
inherited
valueOf<TValue>(TKey key) → TValue?

Operators

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