assertOnRoute method

void assertOnRoute(
  1. RouteView route
)

Assert that the current route matches the given route.

Use this to verify you're on the expected page. Reads as "I should be here right now" — a general check, not an assertion about having just navigated.

Example:

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

Implementation

void assertOnRoute(RouteView route) {
  final currentRoute = Nylo.getCurrentRouteName();
  expect(
    currentRoute,
    route.$1,
    reason:
        'Expected to be on route "${route.$1}" but current route is "$currentRoute"',
  );
}