PropertyDescriptor<P extends Object, F extends Object> class
Represents "property" of view model which uses CompanionPresenterMixin.
This is advanced feature, so normal users should not concern this object.
You can use this descriptor indirectly to:
- Setup FormField or simular widgets. FormFieldValidator is provided via FormPropertiesExtension.getFieldValidator (it internally calls getValidator), which sequentially run validators including asynchronous ones and they should be set to FormField.validator parameters. For vanilla FormField, it is required to bind FormField.onSaved parameters and callbacks returned from FormPropertiesExtension.savePropertyValue methods to work the mixin correctly. The callback internally calls setFieldValue method. name property which should be set to name for some form frameworks.
- Get saved valid value for this property via FormProperties.getValue.
- Checking whether asynchronous validation via FormPropertiesExtension.hasPendingAsyncValidations to show some indicator. It internally calls hasPendingAsyncValidations.
Note that first 2 items can be also handled with form field factories
which are generated by form_companion_generator
.
Conversely, you must use this object to setup form fields to work CompanionPresenterMixin logics correctly.
This object is built with PropertyDescriptorsBuilder which is passed to CompanionPresenterMixin.initializeCompanionMixin.
- Annotations
-
- @sealed
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasPendingAsyncValidations → bool
-
Whether any asynchronous validations is running now.
no setter
- name → String
-
Unique name of this property.
final
- presenter → CompanionPresenterMixin
-
Connected presenter object which implements CompanionPresenterMixin.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- valueTraits → PropertyValueTraits
-
Represents traits of PropertyDescriptor this property's value.
final
Methods
-
getFieldValue(
Locale locale) → F? - Gets a field value (rather than property value) for form field.
-
getInitialValue(
BuildContext context) → F? -
Wraps
initialValue
, which is taken from getFieldValue, with infrastructure support logic for state restoration. -
getValidator(
BuildContext context) → FormFieldValidator< F> - Returns a composite validator which contains synchronous (normal) validators and asynchronous validators.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onChanged(
BuildContext context, ValueSetter< F?> ? onChanged) → ValueSetter<F?> - Wraps specified onChanged, which takes nullable value, with infrastructure support logic for state restoration.
-
onChangedNonNull(
BuildContext context, ValueSetter< F> ? onChanged) → ValueSetter<F> -
Wraps specified
onChanged
, which takes non-nullable value, with infrastructure support logic for state restoration. -
setFieldValue(
F? value, Locale locale) → void - Set a field value (rather than property value) from form field.
-
setPropertyValue(
P? value) → void - Sets a property value directly.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited