clear method
Removes all children controls from the array.
The value and validity state of the array is updated and the event collectionChanges is triggered.
When updateParent
is true or not supplied (the default) each change
affects this control and its parent, otherwise only affects to this
control.
When emitEvent
is true or not supplied (the default), both the
statusChanges and valueChanges emit events with the latest status
and value when the control is reset. When false, no events are emitted.
Implementation
void clear({bool emitEvent = true, bool updateParent = true}) {
forEachChild((control) => control.parent = null);
_controls.clear();
updateValueAndValidity(
emitEvent: emitEvent,
updateParent: updateParent,
);
if (emitEvent) {
emitsCollectionChanged(_controls);
}
}