minLength static method

ValidationRule minLength(
  1. int length, {
  2. String? message,
})

Validation rule to check the minimum length of a string.

Returns message if value is shorter than length.

Implementation

static ValidationRule minLength(int length, {String? message}) {
  return ValidationRule(
    (value) => value != null && value.length >= length ? null : '',
    message ?? 'Must be at least $length characters long',
  );
}