@@ -171,7 +171,7 @@ void main() {
171171 'Test navigating to multiple destinations' ,
172172 (PatrolIntegrationTester $) async {
173173 final Completer <void > navigationFinished = Completer <void >();
174- final Completer <void > newSessionFired = Completer <void >();
174+ Completer <void > newSessionFired = Completer <void >();
175175 int arrivalEventCount = 0 ;
176176 List <NavigationWaypoint > waypoints = < NavigationWaypoint > [];
177177
@@ -202,6 +202,9 @@ void main() {
202202 SimulationOptions (speedMultiplier: 5 ),
203203 );
204204 } else {
205+ // Reset the completer to test that new session event fires again
206+ newSessionFired = Completer <void >();
207+
205208 // Find and remove the waypoint that matches the arrived waypoint
206209 int waypointIndex = - 1 ;
207210 for (int i = 0 ; i < waypoints.length; i++ ) {
@@ -225,6 +228,17 @@ void main() {
225228 ),
226229 );
227230 await GoogleMapsNavigator .setDestinations (updatedDestinations);
231+
232+ // Wait for new session event after updating destinations
233+ await newSessionFired.future.timeout (
234+ const Duration (seconds: 10 ),
235+ onTimeout:
236+ () =>
237+ throw TimeoutException (
238+ 'New navigation session event was not fired after updating destinations' ,
239+ ),
240+ );
241+
228242 await GoogleMapsNavigator .simulator
229243 .simulateLocationsAlongExistingRouteWithOptions (
230244 SimulationOptions (speedMultiplier: 5 ),
0 commit comments