markAsDisabled method

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

Disables the control. This means the control will be exempt from validation checks and excluded from the aggregate value of any parent. Its status is DISABLED.

If the control has children, all children will be disabled to maintain the model.

Implementation

void markAsDisabled({bool updateParent = true, bool emitEvent = true}) {
  _status = DISABLED;

  _forEachChild(
      // Only set self, so that children don't try to update their parent,
      // and thus create a loop of updates.
      (c) => c.markAsDisabled(updateParent: false, emitEvent: emitEvent));
  onUpdate();

  if (emitEvent) _emitEvent();

  _updateAncestors(updateParent, emitEvent);
  _disabledChanges.add(true);
}