minLength static method

String? minLength(
  1. String? value,
  2. int length, {
  3. String fieldName = 'This field',
})

Validates that the input meets a minimum length.

Implementation

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