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