maxLength static method
Creates a validation rule that enforces a maximum string length.
Returns an error message if the string length exceeds max.
If message is not provided, uses a default message.
Example:
Validations.maxLength(100, 'Description must be at most 100 characters')
Implementation
static String Function(String?) maxLength(int max, [String? message]) {
return (String? value) => (value?.length ?? 0) > max ? message ?? 'Must be at most $max characters' : '';
}