validateMinLength static method

String? validateMinLength(
  1. String? value,
  2. int minLength,
  3. String fieldName
)

Implementation

static String? validateMinLength(String? value, int minLength, String fieldName) {
  if (value == null || value.isEmpty) {
    return '$fieldName is required';
  } else if (value.length < minLength) {
    return '$fieldName must be at least $minLength characters';
  }
  return null;
}