navigateBack method

Future<void> navigateBack()

Navigate back by popping the current route, then settle.

Simulates pressing the back button. Useful for testing multi-page navigation flows.

Example:

await tester.visit(DashboardPage.path);
await tester.tapText('Profile');
tester.assertNavigatedTo(ProfilePage.path);

await tester.navigateBack();
tester.assertOnRoute(DashboardPage.path);

Implementation

Future<void> navigateBack() async {
  NyNavigator.instance.router.navigatorKey!.currentState!.pop();
  await settle();
}