-
-
Save sbis04/7253762591e4431c65943a08fa192c70 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double totalDistance = 0.0; | |
// Calculating the total distance by adding the distance | |
// between small segments | |
for (int i = 0; i < polylineCoordinates.length - 1; i++) { | |
totalDistance += _coordinateDistance( | |
polylineCoordinates[i].latitude, | |
polylineCoordinates[i].longitude, | |
polylineCoordinates[i + 1].latitude, | |
polylineCoordinates[i + 1].longitude, | |
); | |
} | |
// Storing the calculated total distance of the route | |
setState(() { | |
_placeDistance = totalDistance.toStringAsFixed(2); | |
print('DISTANCE: $_placeDistance km'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment