updateValueAndValidity method
Recalculates the value and validation status of the control.
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 updateValueAndValidity({
bool updateParent = true,
bool emitEvent = true,
}) {
_setInitialStatus();
_updateValue();
if (enabled) {
_cancelExistingSubscription();
_errors = _runValidators();
_status = _calculateStatus();
if (_status == ControlStatus.valid || _status == ControlStatus.pending) {
_runAsyncValidators();
}
}
if (emitEvent) {
_valueChanges.add(value);
_statusChanges.add(_status);
}
_updateAncestors(updateParent);
}