maxLength static method
Validates that the input does not exceed a maximum length.
Implementation
static String? maxLength(
String? value,
int length, {
String fieldName = 'This field',
}) {
if (value != null && value.length > length) {
return '$fieldName must be at most $length characters';
}
return null;
}