maxValue static method

String? Function(String?) maxValue(
  1. num max, [
  2. String? message
])

Maximum value

Implementation

static String? Function(String?) maxValue(num max, [String? message]) {
  return (value) {
    if (value == null || value.isEmpty) return null;
    final num? parsed = num.tryParse(value);
    if (parsed == null || parsed > max) {
      return message ?? 'Must be at most $max';
    }
    return null;
  };
}