minLength method

PropertyRuleBuilder<T, V> minLength(
  1. int min, [
  2. String? customMessage
])

Asserts that a string property has at least min characters.

Implementation

PropertyRuleBuilder<T, V> minLength(int min, [String? customMessage]) {
  _validators.add((val) {
    if (val is String && val.length < min) {
      return customMessage ?? 'Minimum length is $min characters.';
    }
    return null;
  });
  return this;
}