distance function
Measure distance between two LatLngInfo
coords
Implementation
distance(LatLng locationX, LatLng locationY) {
final locationXLatRadians = _degreesToRadians(locationX.latitude);
final locationYLatRadians = _degreesToRadians(locationY.latitude);
final centralSubtendedAngle = _radiansToDegrees(acos(
sin(locationXLatRadians) * sin(locationYLatRadians) +
cos(locationXLatRadians) *
cos(locationYLatRadians) *
cos(_degreesToRadians(locationX.longitude > locationY.longitude
? (locationX.longitude - locationY.longitude)
: locationY.longitude - locationX.longitude))));
return _greatCircleDistance(centralSubtendedAngle);
}