calculateDistance method
Implementation
double calculateDistance(List<LatLng> points) {
double totalDistance = 0.0;
for (int i = 0; i < points.length - 1; i++) {
totalDistance += Geolocator.distanceBetween(
points[i].latitude,
points[i].longitude,
points[i + 1].latitude,
points[i + 1].longitude,
);
}
return totalDistance;
}