maxLength method
FormFieldValidator
that requires the length of the field's value to be
less than or equal to the provided maximum length.
Implementation
static FormFieldValidator maxLength(
num maxLength, {
String errorText,
}) {
return (val) {
if (val != null && val.length > maxLength) {
return errorText ??
"Value must have a length less than or equal to $maxLength";
}
};
}