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