markAsPristine method

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

Marks the control as pristine.

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

Implementation

void markAsPristine({bool updateParent = true}) {
  _pristine = true;

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

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