validate method

Map<E, List<TimedErrorMessage>> validate(
  1. F formData
)

Validates the entire formData and returns a map of errors per field.

Each key in the returned map represents a field, and the value is a list of timed error messages for that field. Fields with no errors are omitted.

Implementation

Map<E, List<TimedErrorMessage>> validate(F formData) {
  final errors = <E, List<TimedErrorMessage>>{};

  for (final key in keys) {
    final fieldErrors = validateField(key, formData);
    if (fieldErrors.isNotEmpty) {
      errors[key] = fieldErrors;
    }
  }

  return errors;
}