minLength static method

String? minLength(
  1. String? value,
  2. int minLength, {
  3. String? message,
})

Validates that the value has minimum length

Example:

Validators.minLength(value, 8);

Implementation

static String? minLength(String? value, int minLength, {String? message}) {
  if (value == null || value.isEmpty) return null;
  if (value.length < minLength) {
    return message ?? 'Must be at least $minLength characters';
  }
  return null;
}