setErrors method

  1. @internal
void setErrors(
  1. ErrMap<TKey>? map
)

Implementation

@internal
void setErrors(ErrMap<TKey>? map) {
  if (map == null) return;

  fields.forEach((loKey, field) {
    // Field must be touched to assign errors to it
    if (field.touched && map.containsKey(loKey)) {
      // When the map has the key but with a null value,
      // this means to clear the field's error
      field.error = map[loKey];
    }
  });

  status = fields.getStatuses().reduce((res, x) => res.and(x));
}