hasMinLength method

void hasMinLength(
  1. int len, [
  2. String? errorMessage
])

Instructs StringMust to make sure the given string is at least len characters long.

Implementation

void hasMinLength(int len, [String? errorMessage]) {
  _validators.add((value) {
    if (value == null || value.length < len)
      return errorMessage ?? 'String is shorter than $len.';
    return '';
  });
}