markAsEnabled method

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

Enables the control. This means the control will be included in validation checks and the aggregate value of its parent. Its status is re-calculated based on its value and its validators.

If the control has children, all children will be enabled.

Implementation

void markAsEnabled({bool updateParent = true, bool emitEvent = true}) {
  _status = VALID;
  _forEachChild(
      // Only set self, so that children don't try to update their parent,
      // and thus create a loop of updates.
      (c) => c.markAsEnabled(updateParent: false, emitEvent: emitEvent));
  updateValueAndValidity(onlySelf: true, emitEvent: emitEvent);
  _updateAncestors(updateParent, emitEvent);
  _disabledChanges.add(false);
}