clearError method

void clearError()

Clears any visible validation error for this field without resetting the field's value.

This sets errorText to null and hasInteractedByUser to false.

If AutovalidateMode.always is used, the error may reappear immediately because the field will trigger a new validation cycle during the next build. See also:

Implementation

void clearError() {
  setState(() {
    _clearErrorInternal();
  });
  Form.maybeOf(context)?._fieldDidChange();
}