between static method

String? Function(String) between(
  1. num min,
  2. num max, {
  3. String? message,
})

Validates that the input is between min and max.

Implementation

static String? Function(String) between(num min, num max, {String? message}) {
  return (value) {
    if (value.trim().isEmpty) return null;
    final num = double.tryParse(value);
    if (num == null) return 'Please enter a valid number.';
    if (num < min || num > max) {
      return message ?? 'Value must be between $min and $max.';
    }
    return null;
  };
}