call method
Validates whether a value is numeric.
This method checks if the input value can be parsed as a numeric value.
If the value is not numeric, 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 numeric value,
or null if the value is a valid numeric value.
Implementation
@override
String? call(String attribute, String value) {
if (value.isNotEmpty) {
final parsedValue = num.tryParse(value);
if (parsedValue == null) {
return buildMessage(attribute, value);
}
}
return null;
}