hasMaxLength method
Instructs StringMust to make sure the given string
is at most len characters long.
Implementation
void hasMaxLength(int len, [String? errorMessage]) {
_validators.add((value) {
if (value == null || value.length > len)
return errorMessage ?? 'String is longer than $len.';
return '';
});
}