interpolatePoints method
interpolatePoints method interpolates points between two given points. It takes two LatLng objects representing the start and end points, and an int value representing the number of points to interpolate.
Implementation
List<LatLng> interpolatePoints(LatLng start, LatLng end, int numPoints) {
List<LatLng> points = [];
double latStep = (end.latitude - start.latitude) / (numPoints - 1);
double lngStep = (end.longitude - start.longitude) / (numPoints - 1);
for (int i = 0; i < numPoints; i++) {
double lat = start.latitude + i * latStep;
double lng = start.longitude + i * lngStep;
points.add(LatLng(lat, lng));
}
return points;
}