FormGroup<M> class abstract

A reactive group of form controls.

A FormGroup holds a collection of FormControl or other nested FormGroup instances, and provides utilities to read, set, validate and convert form data.

M is the type of the model this group maps to.

Inheritance

Constructors

FormGroup.new(Map<String, AbstractControl> controls)
Creates a FormGroup with the provided controls.

Properties

controls Map<String, AbstractControl>
The map of controls registered in this group.
final
error String?
Returns the first validation error found among the controls.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isListeningControls bool
Whether the group is currently listening to value changes in child controls.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
valid bool
Whether all controls in the group are valid.
no setteroverride
value Map<String, dynamic>
Returns the current value of the group as a map.
no setteroverride

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
contains(String name) bool
Returns whether the control with name exists in this group.
control<T, V>(String name) FormControl<T, V>
Returns a FormControl with the given name.
dispose() → void
Disposes all child controls and this group.
override
fromModel(M model) → void
Sets the control values from a model of type M.
getRawValue() Map<String, dynamic>
Recursively returns the raw value of all controls and nested groups.
group<T extends FormGroup>(String name) → T
Returns the nested FormGroup with the given name.
listenControls() → void
Starts listening to all child controls' value changes to notify listeners.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
register(String name, AbstractControl control) → void
Registers a new control under the given name.
registerAll(Map<String, AbstractControl> newControls) → void
Registers multiple controls at once.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
setValue(Map<String, dynamic> val) → void
Sets the values of all controls from the provided map val.
override
textControl(String name) FormControl<TextEditingValue, String>
Returns a FormControl specialized for text input with the given name.
toModel() FutureOr<M>
Converts the form state to a model object of type M.
toString() String
A string representation of this object.
inherited
validateResult() → AsyncResult<FormGroup<M>>
Validates the form group and returns a Result.

Operators

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