removeAt method
Removes and returns the child control at the given index.
The argument index is the index position of the child control to remove.
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
AbstractControl<T> removeAt(
int index, {
bool emitEvent = true,
bool updateParent = true,
}) {
final removedControl = _controls.removeAt(index);
removedControl.parent = null;
updateValueAndValidity(emitEvent: emitEvent, updateParent: updateParent);
if (emitEvent) {
emitsCollectionChanged(_controls);
}
return removedControl;
}