setErrors method

void setErrors(
  1. Map<String, dynamic> errors, {
  2. bool markAsDirty = true,
})

Sets errors on a form control when running validations manually, rather than automatically.

If markAsDirty is true or not set (default) then the control is marked as dirty.

See dirty.

Implementation

void setErrors(Map<String, dynamic> errors, {bool markAsDirty = true}) {
  _errors.clear();
  _errors.addAll(errors);

  _updateControlsErrors();

  if (markAsDirty) {
    this.markAsDirty(emitEvent: false);
  }
}