setError method

void setError(
  1. String? msg
)

Manual set error, used to update error message by validate outsite

Implementation

void setError(String? msg) {
  if (msg == _error) return;
  _error = msg;
  _status = _error != null ? ValidateStatus.invalid : ValidateStatus.valid;
  //notify ignore validate again
  if (hasValidator) {
    _validatedNotify();
  } else {
    notify();
  }
}