distanceTo method

double distanceTo(
  1. Location other
)

Implementation

double distanceTo(Location other) {
  final otherLatitude = other.latitude;
  final otherLongitude = other.longitude;
  final lat1 = _degreesInRadians(latitude);
  final lat2 = _degreesInRadians(otherLatitude);
  final dLat = _degreesInRadians(otherLatitude - latitude);
  final dLon = _degreesInRadians(otherLongitude - longitude);
  return 12742000 *
      asin(sqrt(pow(sin(dLat / 2), 2) +
          cos(lat1) * cos(lat2) * pow(sin(dLon / 2), 2)));
}