minLength static method
Check if the string
has min min
chars
if string
is not null and not empty.
Returns null
if is valid.
Returns FieldBlocValidatorsErrors.minLength if is not valid. Min length validator.
Implementation
static Validator<String?> minLength(int min, {String? errorMessage}) {
return (String? string) {
if (string == null || string.isEmpty || string.length >= min) {
return null;
}
return errorMessage ?? FieldBlocValidatorsErrors.minLength;
};
}