max static method

String? max(
  1. num? value,
  2. num maxValue, {
  3. String? fieldName,
})

Validates maximum numeric value.

Implementation

static String? max(num? value, num maxValue, {String? fieldName}) {
  if (value == null) {
    return null;
  }

  if (value > maxValue) {
    return '${fieldName ?? "Value"} must not exceed $maxValue.';
  }

  return null;
}