isLatitude method

bool isLatitude(
  1. String value
)

Check if the string is a valid latitude.

Parameters:

  • value The string to be evaluated.

Returns:

A boolean indicating whether the value is a valid latitude.

Implementation

bool isLatitude(String value) {
  final String latitudeValue = value.replaceAll(',', '.');

  final double? latitude = double.tryParse(latitudeValue);
  if (latitude == null) {
    return false;
  }
  return latitude >= -90 && latitude <= 90;
}