markAsUntouched method

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

Marks the control as untouched.

If the control has any children, it will also mark all children as untouched to maintain the model, and re-calculate the touched status of all parent controls.

Implementation

void markAsUntouched({bool updateParent = true}) {
  _touched = false;

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

  var parent = _parent;
  if (parent != null && updateParent) {
    parent._updateTouched(updateParent);
  }
}