form_companion_presenter library

Defines mixin and helpers to build presenter of form widget which uses flutter native form field classes.

Classes

AsyncInvocationFailureContext<T>
Context information of AsyncOperationFailedCallback to handle failed asynchronous execution result.
AsyncOperationNotifier<R, P>
Defines interface which is the parameter of FutureInvoker.execute method must implement to notify asynchronous operation status.
AsyncValidatorExecutor<T extends Object>
Handles asynchronous (Future based) validation logic.
AsyncValidatorOptions
Options for asyncronous validators.
CompanionPresenterFeatures<A extends FormStateAdapter>
Defines overridable CompanionPresenterMixin subtype specific features.
ConversionResult<T extends Object>
Represents successful conversion result.
FailureResult<T extends Object>
Represents any conversion failure.
FormProperties
Represents properties of the form bound to the presenter.
FormPropertiesRestorationScope
Enables input state restoration for form properties of specified presenter which is mix-ined with CompanionPresenterMixin.
FormStateAdapter
Defines interface between CompanionPresenterMixin and actual state of Form.
FutureInvoker<T extends AsyncOperationNotifier<R, P>, R, P>
Turns Future based async operation to callback based state machine.
OnPropertiesChangedEvent
Represents event data of CompanionPresenterMixin.onPropertiesChanged.
PropertyDescriptor<P extends Object, F extends Object>
Represents "property" of view model which uses CompanionPresenterMixin.
PropertyDescriptorsBuilder
Builder object to build PropertyDescriptor.
SomeConversionResult<T extends Object>
Represents a result of conversion from form field input value to property value.
StringConverter<P extends Object>
Basic implementation of ValueConverter for string typed FormField such as text field based form field.
ValidationInvocation<T>
Represents asynchronous validation invocation.
ValidatorCreationOptions
Options for validator factories.
ValueConverter<P extends Object, F extends Object>
Defines value converter between PropertyDescriptor<P> value and FormField<F> value.

Enums

AsyncOperationStatus
Represents status of asynchronous operation.
PropertyValueTraits
Represents traits of PropertyDescriptor value.

Mixins

CompanionPresenterMixin
Provides base implementation of presenters which cooporate with correspond Form and FormFields to handle user inputs, their transitive states, validations, and submission.
FormCompanionMixin
Extended mixin of CompanionPresenterMixin for vanilla Form.

Extensions

CompanionPresenterMixinExtension on CompanionPresenterMixin
Provides helper methods of CompanionPresenterMixin.
FormCompanionPropertyDescriptorsBuilderExtension on PropertyDescriptorsBuilder
Defines convinient extension methos for PropertyDescriptorsBuilder to define typical type combinations.
FormPropertiesExtension on FormProperties
Provides convinient members to access properties.

Properties

bigIntDoubleConverter ValueConverter<BigInt, double>
A ValueConverter between int property value type and double form field value type.
final
bigIntRestorableValueFactory RestorableValueFactory<BigInt>
A RestorableValueFactory for BigInt.
final
bigIntStringConverter StringConverter<BigInt>
StringConverter which uses BigInt.tryParse.
final
boolRestorableValueFactory RestorableValueFactory<bool>
A RestorableValueFactory for bool.
final
dateTimeRangeRestorableValueFactory RestorableValueFactory<DateTimeRange>
A RestorableValueFactory for DateTimeRange.
final
dateTimeRestorableValueFactory RestorableValueFactory<DateTime>
A RestorableValueFactory for DateTime.
final
dateTimeStringConverter StringConverter<DateTime>
StringConverter which uses DateTime.tryParse.
final
doubleRestorableValueFactory RestorableValueFactory<double>
A RestorableValueFactory for double.
final
doubleStringConverter StringConverter<double>
StringConverter which uses double.tryParse.
final
intDoubleConverter ValueConverter<int, double>
A ValueConverter between int property value type and double form field value type.
final
intRestorableValueFactory RestorableValueFactory<int>
A RestorableValueFactory for int.
final
intStringConverter StringConverter<int>
StringConverter which uses int.tryParse.
final
rangeValuesRestorableValueFactory RestorableValueFactory<RangeValues>
A RestorableValueFactory for RangeValues.
final
stringRestorableValueFactory RestorableValueFactory<String>
A RestorableValueFactory for String.
final
uriStringConverter StringConverter<Uri>
StringConverter which uses Uri.tryParse.
final

Typedefs

AsyncErrorHandler = void Function(AsyncError error)
Callback for AsyncError handling. The parameter is AsyncError which is thrown by asynchronous operation.
AsyncOperationCompletedCallback<T> = void Function(T result)
Callback which called when async operation is completed successfully The parameter is T which is asynchronous operation result.
AsyncOperationFailedCallback = void Function(AsyncError failure)
Callback which called when async operation is failed with error.
AsyncOperationFailureHandler<T> = void Function(AsyncInvocationFailureContext<T> failure)
Callback which called when async operation is failed with error. The parameter is AsyncInvocationFailureContext to handle the error.
AsyncOperationProgressCallback<P> = void Function(P progress)
Callback which called periodically in the implementation specific frequency when async operation is progress some degree. The parameter is P which represents some object to represent the progress. It may tell degree of progress with percentage int, double representing completion ratio, or String describing qualitative status. It might have additional information to help to discrimination among concurrent operations by caller.
AsyncValidationCompletionCallback = void Function(String? result, AsyncError? error)
Callback of completion of AsyncValidator.
AsyncValidationFailureHandler = void Function(AsyncInvocationFailureContext<String?> context)
Callback of exceptional completion of AsyncValidatorExecutor.validate. You can change the exception or error via AsyncInvocationFailureContext.overrideError.
AsyncValidator<T> = FutureOr<String?> Function(T? value, AsyncValidatorOptions options)
A function represents async validation invocation.
AsyncValidatorFactory<T> = AsyncValidator<T> Function(ValidatorCreationOptions options)
Signature for factory of AsyncValidator.
FieldToPropertyConverter<P extends Object, F extends Object> = SomeConversionResult<P> Function(F?, Locale)
A function which converts form field input value F to property value P.
FormFieldValidatorFactory<T> = FormFieldValidator<T> Function(ValidatorCreationOptions options)
Signature for factory of FormFieldValidator.
ParseFailureMessageProvider = String Function(String?, FormatException?, Locale)
A function which returns localized, user friendly message for parse or tryParse failure from specified input String and Locale.
Parser<P extends Object> = SomeConversionResult<P> Function(String?, Locale, ParseFailureMessageProvider )
A function which converts String to property value P.
PropertyToFieldConverter<P extends Object, F extends Object> = F? Function(P?, Locale)
A function which converts property value P to form field initial value F.
RestorableValueFactory<F extends Object> = RestorableValue<F?> Function()
Function which creates appropriate RestorableValue subtype for F.
Stringifier<P extends Object> = PropertyToFieldConverter<P, String>
A function which converts property value P to String.