markAsUntouched method Null safety

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

Marks the control as untouched.

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), a notification event is emitted.

Implementation

void markAsUntouched({bool updateParent = true, bool emitEvent = true}) {
  if (_touched) {
    _touched = false;
    forEachChild((control) => control.markAsUntouched(updateParent: false));

    if (emitEvent) {
      _touchChanges.add(_touched);
    }

    if (updateParent) {
      parent?.updateTouched(updateParent: updateParent);
    }
  }
}