call method
Validates whether a value is a valid integer.
This method checks if the input value is a valid integer by attempting to parse it.
If the value is not a valid integer, 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 value is not a valid integer, or null if the value is valid.
Implementation
@override
String? call(String attribute, String value) {
if (value.isNotEmpty) {
final parsedValue = int.tryParse(value);
if (parsedValue == null) {
return buildMessage(attribute, value);
}
}
return null;
}