FormCompanionMixin mixin
Extended mixin of CompanionPresenterMixin for vanilla Form.
It is required for submit method that there is a Form widget as an ancestor in BuildContext.
This class supports following features:
- Decouples validation logic from view layer -- validation logic often should exist in domain layer to encourage reuse.
- Async validation handling. This class tracks pending asynchronous
validation logics. The underlying validation infrastructure supports:
- Throttling. If continous validation requests are issued, the validation will only handle last one. FormField often issues continous validation because of such user input like fast text typing as well as repeated validate() calls.
- Caching. Since async validation can be costly and idempotent in most cases, and the result must be same for identical input, so caching validation result reduces latency. It also second guard about continuous validation requests.
- Disables "submit" action. The submit method returns Function when it
is ready for "submit" or
null
otherwise. This class checks validation results of FormFields and existance of pending async validations.
- Superclass Constraints
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
presenterFeatures
→ CompanionPresenterFeatures<
FormStateAdapter> -
Do not use this property directly, use methods on
CompanionPresenterMixinExtension instead.
no setteroverride
- propertiesState → FormProperties
-
Gets a current FormProperties which holds properties' values and
their PropertyDescriptors.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
canSubmit(
BuildContext context) → bool -
Returns whether the state of this presenter is "completed" or not.
override
-
doSubmit(
) → FutureOr< void> -
Execute "submit" action.
inherited
-
getKey(
String name, BuildContext context) → Key - Gets a key for specified named field.
-
initializeCompanionMixin(
PropertyDescriptorsBuilder properties) → void -
Initializes CompanionPresenterMixin.
You must call this method (or overriden method) in your presenter's
constructor to work mixins correctly.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onPropertiesChanged(
OnPropertiesChangedEvent event) → void -
Called when any property values are changed.
OnPropertiesChangedEvent.newProperties stores new values of the properties.
inherited
-
resetPropertiesState(
FormProperties newProperties) → FormProperties -
Resets propertiesState with specified new FormProperties.
inherited
-
submit(
BuildContext context) → VoidCallback? -
Returns submit callback suitable for
onClick
callback of button which representssubmit
of form.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited