custom<T> static method

Validator<T> custom<T>(
  1. bool validate(
    1. T value,
    2. ValidationContext context
    ), {
  2. String error = '',
})

Implementation

static Validator<T> custom<T>(
  bool Function(T value, ValidationContext context) validate, {
  String error = '',
}) =>
    (value, context) {
      if (validate(value, context)) return (true, null);
      return (false, error);
    };