maxLength static method
Validate maximum length
Implementation
static String? maxLength(String? value, int maxLength, {String? fieldName}) {
if (value != null && value.length > maxLength) {
return '${fieldName ?? 'This field'} must be at most $maxLength characters';
}
return null;
}