BloomFieldArray<T extends BloomFormControl> class
Reactive controller for a repeating collection of child form controls or sub-forms.
Supports adding, removing, and reordering child items reactively. Adding or removing entries automatically updates the fields signal, notifying reactive boundaries.
final todoItems = BloomFieldArray<BloomFormField>(
initialValues: [
BloomFormField(initialValue: 'First task'),
],
);
todoItems.add(BloomFormField(initialValue: 'Second task'));
- Implemented types
Constructors
-
BloomFieldArray({List<
T> initialValues = const [], List<T> itemFactory()?, List<String? Function(List< validators = const [], List<T> )>Future< asyncValidators = const [], Duration asyncDebounce = const Duration(milliseconds: 300)})String?> Function(List<T> )> -
Creates a reactive field array initialized with
initialValuesor an optionalitemFactory.
Properties
- asyncDebounce → Duration
-
Debounce duration applied when validateAsync is called with
debounce: true.final -
asyncValidators
→ List<
Future< String?> Function(List<T> )> -
Optional array-level asynchronous validators.
final
-
errors
↔ Signal<
List< String> > -
Reactive signal containing array-level validation errors.
latefinaloverride-getter
-
fields
↔ Signal<
List< T> > -
Reactive signal holding the ordered list of child controls.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
isDirty
↔ ReadonlySignal<
bool> -
Computed signal indicating whether any child is dirty or the array membership has changed.
latefinaloverride-getter
-
isTouched
↔ Signal<
bool> -
Reactive signal indicating whether this array has been interacted with.
latefinaloverride-getter
-
isValid
↔ ReadonlySignal<
bool> -
Computed signal returning
truewhen all child controls are valid and array-level errors is empty.latefinaloverride-getter -
isValidating
↔ ReadonlySignal<
bool> -
Reactive signal indicating whether array-level or child-level validation is currently in flight.
latefinaloverride-getter
- length → int
-
Returns the current number of child controls in the array.
no setter
- rawValue → dynamic
-
Returns the raw untyped list of child control values.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
validators
→ List<
String? Function(List< T> )> -
Optional array-level synchronous validators (e.g. minItems, maxItems).
final
Methods
-
add(
T control) → void -
Appends
controlto the end of the array. -
clear(
) → void - Clears all child controls from the array.
-
insert(
int index, T control) → void -
Inserts
controlat positionindex. -
move(
int oldIndex, int newIndex) → void -
Moves a control from
oldIndextonewIndex. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove(
T control) → bool -
Removes the first occurrence of
controlfrom the array. -
removeAt(
int index) → T -
Removes and returns the control at
index. -
reset(
) → void -
Resets the array back to its initial controls and resets each child.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
touch(
) → void -
Marks this array and all its child controls as touched.
override
-
validate(
) → bool -
Runs array-level validators and triggers validate on every child control.
override
-
validateAsync(
{bool debounce = false}) → Future< bool> -
Asynchronously validates all child controls and evaluates array-level asyncValidators.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
int index) → T -
Returns the child control at
index.