getErrors method

Map<String, List<String>> getErrors()

Get error messages associated with form attributes.

The getErrors function is used to retrieve error messages associated with form attributes that have errors. It creates a copy of the _errors map, removes entries for attributes that do not exist in the _attributes map, and returns the resulting map of attribute-error message pairs.

Returns: A map of form attribute identifiers to lists of error messages.

Implementation

Map<String, List<String>> getErrors() {
  final Map<String, List<String>> errors = Map.from(_errors);
  errors.removeWhere((key, value) => !_attributes.containsKey(key));
  return errors;
}