-
Notifications
You must be signed in to change notification settings - Fork 38
Description
Is there an existing issue for this?
- I have searched the existing issues
Description of the bug
When continueToNextDestination is called in a multi-destination navigation flow, OnNavInfoEventCallback starts to get corrupted data. It's mixing remainingSteps and shows weird data that is not correct.
This is making displaying steps or calculating distance wrong, so I get a blink in UI until data gets fixed after one or two OnNavInfoEventCallbacks.
Flutter version
3.35.3
Package version
0.6.4
Native SDK versions
- I haven't changed the version of the native SDKs
Flutter Doctor Output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.35.3, on macOS 15.3 24D60 darwin-arm64, locale en-RS)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2025.1)
[✓] VS Code (version 1.97.2)
[✓] Connected device (6 available)
! Error: lazar’s iPad has recently restarted. Xcode will continue when lazar’s iPad is unlocked. (code -14)
[✓] Network resources
• No issues found!
Steps to reproduce
- Add multiple destinations using setDestinations (for example 2)
- Start navigation and when setOnArrivalListener is triggered call GoogleMapsNavigator.continueToNextDestination()
- observe OnNavInfoEventCallback before and after continueToNextDestination call
Expected vs Actual Behavior
Before continue action:
navInfo.currentStep
stepNumber: 3, distanceFromPrev: 662, fullInstructions:
navInfo.remainingSteps
stepNumber: 0, distanceFromPrev: 0, fullInstructions: Head north on Zetska towards Dušana Popovića
stepNumber: 1, distanceFromPrev: 656, fullInstructions:
After continue action:
navInfo.currentStep
stepNumber: 0, distanceFromPrev: 0, fullInstructions: Head west on Igmanska
navInfo.remainingSteps
stepNumber: 1, distanceFromPrev: 129, fullInstructions: Turn left to stay on Igmanska (*this steps is already done)
stepNumber: 2, distanceFromPrev: 76, fullInstructions: Turn right onto Zetska (*this steps is already done)
stepNumber: 3, distanceFromPrev: 662, fullInstructions: (*this steps is already done)
stepNumber: 0, distanceFromPrev: 0, fullInstructions: Head north on Zetska towards Dušana Popovića
stepNumber: 1, distanceFromPrev: 656, fullInstructions:
After 2 more OnNavInfoEventCallback events state gets back to normal:
navInfo.currentStep
stepNumber: 0, distanceFromPrev: 0, fullInstructions: Head north on Zetska towards Igmanska
navInfo.remainingSteps
stepNumber: 1, distanceFromPrev: 710, fullInstructions:
Code Sample
//Set user location to something like: 43.304447, 21.912585
List<NavigationWaypoint> waypointsList2 = [
NavigationWaypoint.withLatLngTarget(
title: "Waypoint 1",
target: LatLng(
latitude: 43.30580381,
longitude: 21.91264903,
),
),
NavigationWaypoint.withLatLngTarget(
title: "Waypoint 2",
target: LatLng(
latitude: 43.31158066,
longitude: 21.91121307,
),
),
];
final Destinations destinations = Destinations(
waypoints: waypointsList2,
displayOptions: NavigationDisplayOptions(showDestinationMarkers: false),
routingOptions: RoutingOptions(
travelMode: NavigationTravelMode.driving,
alternateRoutesStrategy: NavigationAlternateRoutesStrategy.none,
),
);Additional Context
Another thing that is wrong with NavInfo is the data for:
/// The estimated remaining distance in meters to the final destination which
/// is the last destination in a multi-destination trip.
final int? distanceToFinalDestinationMeters;
/// The estimated remaining time in seconds to the final destination which is
/// the last destination in a multi-destination trip.
final int? timeToFinalDestinationSeconds;
From docs it should have the distance from the last destination in multi-destination trip, but it's returning data to the first upcoming destination.