reactive_forms library

This library is a model-driven approach to handling Forms inputs and validations, heavily inspired in Angular's Reactive Forms.

Classes

AbstractControl<T>
This is the base class for FormGroup, FormArray and FormControl.
Control
Utility class for AbstractControl
ControlState<T>
Represent the state of a FormControl.
ControlValueAccessor<ModelDataType, ViewDataType>
Defines an interface that acts as a bridge between FormControl and a reactive native widget.
DateTimeValueAccessor
Represents a control value accessor that convert between data types DateTime and String.
DefaultValueAccessor<ModelDataType, ViewDataType>
Represents a control value accessor that does not convert between data types at all.
DoubleValueAccessor
Represents a control value accessor that convert between data types double and String.
FocusController
Represents a focus controller for a FormControl.
FormArray<T>
A FormArray aggregates the values of each child FormControl into an array.
FormBuilder
Creates an AbstractControl from a user-specified configuration.
FormControl<T>
Tracks the value and validation status of an individual form control.
FormControlCollection<T>
The base class form FormGroup and FormArray. Its provides methods for get a control by name and a Listenable that emits events each time you add or remove a control to the collection.
FormGroup
Tracks the value and validity state of a group of FormControl instances.
InheritedNotifierElement<T>
InheritedStreamer<T>
IntValueAccessor
Represents a control value accessor that convert between data types int and String.
Iso8601DateTimeValueAccessor
Represents a control value accessor that converts from Iso8601 string value to a DateTime data type.
ReactiveCheckbox
This is a convenience widget that wraps a Checkbox widget in a ReactiveCheckbox.
ReactiveCheckboxListTile
This is a convenience widget that wraps a CheckboxListTile widget in a ReactiveCheckboxListTile.
ReactiveDatePicker<T>
This is a convenience widget that wraps the function showDatePicker in a ReactiveDatePicker.
ReactiveDatePickerDelegate<T>
This class is responsible of showing the picker dialog.
ReactiveDropdownField<T>
A reactive widget that wraps a DropdownButton.
ReactiveForm
This class is responsible for create a FormControlInheritedStreamer for exposing a FormGroup to all descendants widgets.
ReactiveFormArray<T>
This class is responsible for create a FormControlInheritedStreamer for exposing a FormArray to all descendants widgets.
ReactiveFormArrayState<T>
ReactiveFormBuilder
This class is responsible for create a FormControlInheritedStreamer for exposing a FormGroup to all descendants widgets.
ReactiveFormBuilderState
ReactiveFormConsumer
Obtains FormGroup from its ancestors and passes its value to builder.
ReactiveFormField<ModelDataType, ViewDataType>
A single reactive form field.
ReactiveFormFieldState<ModelDataType, ViewDataType>
Represents the state of the ReactiveFormField stateful widget.
ReactiveRadio<T>
This is a convenience widget that wraps a Radio widget in a ReactiveRadio.
ReactiveRadioListTile<T>
This is a convenience widget that wraps a RadioListTile widget in a ReactiveRadioListTile.
ReactiveSlider
This is a convenience widget that wraps a Slider widget in a ReactiveSlider.
ReactiveStatusListenableBuilder
This widget listen for changes in the status of a FormControl specified in formControlName property and call builder function to rebuild widgets.
ReactiveSwitch
This is a convenience widget that wraps a Switch widget in a ReactiveSwitch.
ReactiveSwitchListTile
This is a convenience widget that wraps a SwitchListTile widget in a ReactiveSwitchListTile.
ReactiveTextField<T>
A ReactiveTextField that contains a TextField.
ReactiveTimePicker
This is a convenience widget that wraps the function showTimePicker in a ReactiveTimePicker.
ReactiveTimePickerDelegate
This class is responsible of showing the picker dialog.
ReactiveValueListenableBuilder<T>
A widget whose content stays synced with a ValueListenable.
SliderIntValueAccessor
Represents a control value accessor that convert int to double data types
TimeOfDayValueAccessor
Represents a control value accessor that convert between data types TimeOfDay and String.
ValidationMessage
This class is an utility for getting access to common names of validation messages.
Validator<T>
An interface implemented by classes that perform synchronous validation.
Validators
Provides a set of built-in validators that can be used by form controls.

Enums

CompareOption
Represents the comparison option in Validators.compare validator
ControlStatus
Enums that represents the different validation status of an AbstractControl

Extensions

ControlExtension on AbstractControl
This is an extension on AbstractControl.
StringControlExtension on AbstractControl<String>
This is an extension on AbstractControl<String>.

Properties

fb FormBuilder
Global FormBuilder instance.
final

Typedefs

AsyncValidatorFunction = Future<Map<String, dynamic>?> Function(AbstractControl control)
Signature of a function that receives a control and returns a Future that emits validation errors if present, otherwise null.
ChangeFunction<K> = dynamic Function(K? value)
Type of the function to be called when the control emits a value changes event.
ReactiveDatePickerBuilder<T> = Widget Function(BuildContext context, ReactiveDatePickerDelegate<T> picker, Widget? child)
A builder that builds a widget responsible to decide when to show the picker dialog.
ReactiveFormArrayBuilder<T> = Widget Function(BuildContext context, FormArray<T> formArray, Widget? child)
Called to obtain the child widget. This is the signature of a function that receives the context, the formArray and an optional child and returns a Widget.
ReactiveFormBuilderCreator = FormGroup Function()
ReactiveFormConsumerBuilder = Widget Function(BuildContext context, FormGroup formGroup, Widget? child)
Builder function definition of the ReactiveFormConsumer builder.
ReactiveFormFieldBuilder<T, K> = Widget Function(ReactiveFormFieldState<T, K> field)
Signature for building the widget representing the form field.
ReactiveListenableWidgetBuilder<T> = Widget Function(BuildContext context, AbstractControl<T> control, Widget? child)
This is the definition of the builder function used in the widgets ReactiveStatusListenableBuilder and ReactiveValueListenableBuilder.
ReactiveSliderLabelBuilder = String Function(double)
Signature for callbacks that are used to get the label of the ReactiveSlider.
ReactiveTimePickerBuilder = Widget Function(BuildContext context, ReactiveTimePickerDelegate picker, Widget? child)
A builder that builds a widget responsible to decide when to show the picker dialog.
ShowErrorsFunction = bool Function(AbstractControl control)
Signature for customize when to show errors in a widget.
ValidationMessagesFunction<T> = Map<String, String> Function(FormControl<T> control)
Signature of the function that returns the Map that store custom validation messages for each error.
ValidatorFunction = Map<String, dynamic>? Function(AbstractControl control)
Signature of a function that receives a control and synchronously returns a map of validation errors if present, otherwise null.

Exceptions / Errors

BindingCastException<T, K>
Represents an exception that is thrown when trying to bound a widget that is expecting a specific data type, to a control with a different data type.
FormArrayInvalidIndexException
This exception is thrown when the index used to access a control in a FormArray is not a valid integer number.
FormBuilderInvalidInitializationException
This exception is thrown by FormBuilder when trying to create controls with bad initialization params.
FormControlNotFoundException
This exception is thrown when a FormGroup or a FormArray doesn't find the FormControl by name
FormControlParentNotFoundException
This exception is thrown by Reactive Widgets that doesn't find a parent widget ReactiveForm or ReactiveFormArray in the widgets tree.
ReactiveFormsException
Represents the base class for all the Reactive Forms Exceptions
ValidatorException
Represents an exception thrown by a validator
ValueAccessorException
Exception that is raised by ControlValueAccessor