distanceTo method
Returns the approximate distance in meters between this location and the given location.
For distance calculations we use the 'haversine' formula to calculate the great-circle distance between two points. See http://www.movable-type.co.uk/scripts/latlong.html for details on how to calculate distance, bearing and more between latitude/longitude points.
Implementation
double distanceTo(GeoPosition destination) {
final sDLat =
math.sin((degToRad(destination.latitude) - degToRad(latitude)) / 2);
final sDLng =
math.sin((degToRad(destination.longitude) - degToRad(longitude)) / 2);
final a = sDLat * sDLat +
sDLng *
sDLng *
math.cos(degToRad(latitude)) *
math.cos(degToRad(destination.latitude));
final c = 2 * math.atan2(math.sqrt(a), math.sqrt(1 - a));
return earthRadius * c;
}