isBetween static method

FormFieldValidator<num> isBetween(
  1. num min,
  2. num max, {
  3. String? message,
})

Implementation

static FormFieldValidator<num> isBetween(num min, num max, {String? message}) {
  return (value) {
    if (value == null) {
      return null;
    }

    if (value < min || value > max) {
      return message ?? 'Value must be between $min and $max';
    }

    return null;
  };
}