call method
Validates whether the length of a value does not exceed the specified number.
This method checks if the length of the input value does not exceed the provided number.
If the length of the value exceeds the number, an error message is generated
using the buildMessage method.
Parameters:
attribute: The identifier of the form attribute being validated.value: The value to be validated.
Returns:
A validation error message if the length of the value exceeds the specified number,
or null if the value is valid.
Implementation
@override
String? call(String attribute, String value) {
if (value.isNotEmpty) {
if (value.length > number) {
return buildMessage(attribute, value, onExtra: (message) {
message.replaceAll(':number', number.toString());
return message;
});
}
}
return null;
}