validateFirst<T> function

TFormFieldValidator<T> validateFirst<T>(
  1. Iterable<TFormFieldValidator<T>> validators
)

Runs validators in order and returns the first error, or null when all accept the value.

Implementation

TFormFieldValidator<T> validateFirst<T>(Iterable<TFormFieldValidator<T>> validators) => (value) {
  for (final validator in validators) {
    final error = validator(value);
    if (error != null) return error;
  }
  return null;
};