every<T> static method

Validator<T> every<T>(
  1. List<Validator<T>> validators, {
  2. String? error,
})

Implementation

static Validator<T> every<T>(
  List<Validator<T>> validators, {
  String? error,
}) =>
    (value, context) {
      final validator = AndValidator(validators, context);
      final result = validator.validate(value);
      if (result.isValid) return (true, null);
      return (false, error ?? 'A validator passed, which is not allowed');
    };