run<TKey> static method
Runs all validators
on values
, then return the error messages or
null
accordingly.
Implementation
static ErrMap<TKey> run<TKey>(
List<LoFormBaseValidator<TKey>> validators,
ValMap<TKey> values,
) {
final ErrMap<TKey> errors = {};
for (final validator in validators) {
final localErrors = validator.validate(values) ?? {};
// Prevent overwriting errors
localErrors.removeWhere(
(key, value) => errors[key] != null,
);
errors.addAll(localErrors);
}
return errors;
}