markAsEnabled method Null safety

void markAsEnabled(
  1. {bool updateParent = true,
  2. bool emitEvent = true}

Enables the control. This means the control is included in validation checks and the aggregate value of its parent. Its status recalculates based on its value and its validators.

When updateParent is false, mark only this control. When true or not supplied, marks all direct ancestors. Default is true.

When emitEvent is true or not supplied (the default), valueChanges and statusChanged events are emitted if value or status change. Otherwise the control update this values but none of this events are emitted.


void markAsEnabled({bool updateParent = true, bool emitEvent = true}) {
  if (enabled) {
  _status = ControlStatus.valid;
  updateValueAndValidity(updateParent: true, emitEvent: emitEvent);