getRouteTraveled static method
Get the traveled route from the user's location
route the original route
point the user's location
Return the traveled route from the user's location
Implementation
static List<LatLng> getRouteTraveled(List<LatLng> route, LatLng point) {
final nearest = snapToRoute(route, point);
if (nearest == null) {
return [];
}
return [...route.sublist(0, nearest.index), point];
}