custom<T> static method

Validator<T> custom<T>(
  1. bool test(
    1. T
    ), [
  2. String? message
])

Implementation

static Validator<T> custom<T>(bool Function(T) test, [String? message]) {
  return (value) => !test(value) ? (message ?? 'Invalid value') : null;
}