isLongitude method
Check if the string is a valid longitude.
Parameters:
value
The string to be evaluated.
Returns:
A boolean indicating whether the value is a valid longitude.
Implementation
bool isLongitude(String value) {
final String longitudeValue = value.replaceAll(',', '.');
final double? longitude = double.tryParse(longitudeValue);
if (longitude == null) {
return false;
}
return longitude >= -180 && longitude <= 180;
}