maxLength static method
Returns a validator that checks whether a field has a maximum length.
Implementation
static String? Function(String?) maxLength(int max, [String? message]) {
return (value) {
if (value != null && value.length > max) {
return message ?? 'Maximum $max characters allowed';
}
return null;
};
}