GoRouter.dev

Current field guide · 2026

Test journeys, not only matches

Verify the requested URI, the visible screen, the navigation frame, and the way back.

Edition published 21 Oct 2026go_router 18.1.1 reference
On this page

A small matrix catches large regressions

For each important destination, test direct entry, in-app entry, Back, and reload where relevant. Add signed-in and signed-out states for protected routes. Test empty and malformed identifiers as well as the happy path.

Assert visible behavior

A route existing in the configuration does not prove that its screen is visible. In widget tests, inspect the displayed content and the navigation frame. In browser tests, inspect the actual URL and the document response after a fresh entry.

Keep routing independent of a live backend

Use controlled repositories and session state to make loading, missing-resource, and authentication outcomes deterministic. Keep separate integration tests for real APIs and platform deep links.

Know the limits of this explorer

The interactive route explorer on this website is a JavaScript model of URL parsing and matching. It does not execute Dart or emulate Flutter's Navigator. Use it to understand the contract, then run the downloaded Flutter example with the SDK version you ship.

dart / example
// Suggested journey assertions:
// 1. /books/42 opens book 42 directly.
// 2. A malformed ID shows a useful error.
// 3. A protected route redirects while signed out.
// 4. Back returns to the expected parent or branch.
// 5. Web refresh serves the app, not a hosting 404.

Sources & version context

GoRouter.dev documentation edition. Examples illustrate the APIs described in the linked primary documentation. Adapt application-owned widgets and services to your project. They are not an executed Flutter session in this browser.

Separate route and focus

A documentation-only test trace: start on Items with the link focused, activate Details, record the visible page heading and actual focus target, press Tab once, then return and record where focus lands. A correct URL is only one observation; absent focus movement remains a separate result. Keep expected and observed in separate columns. Running this trace in a web model cannot verify a Flutter build.

Example observation sheet: URI /items/7; heading Item 7; first Tab returns to the global menu; detail controls reached only after seven keys. Record these as hypothetical observations and repeat using the actual application. Template for each transition: entry method, expected target, observed target, next Tab stop, Back result. The reference page identifies go_router 18.1.1. This keyboard review does not require a Flutter build.

Activate Details; Record page heading; Press Tab once; Record actual focus target; Navigate back; Record focus on return
Navigate back: Record focus on return. © gorouter.dev · CC BY 4.0.

W3C WAI · Understanding Focus Order

Write a URL test matrix for three nested destinations

Sketch one branch on paper. Its root pattern is /teams/:teamId, its child is members/:memberId and the grandchild is notes/:noteId. The child patterns are relative. In the destination column put team overview, member profile and note detail respectively. This worksheet describes expected routing behaviour for that specific design.

Use three positive inputs. /teams/7 should identify just team 7. /teams/7/members/4 adds member 4. /teams/7/members/4/notes/2 yields the tuple (7, 4, 2). Now change just one value: /teams/7/members/5/notes/2 must carry member 5, never the previous 4. A query such as ?mode=read belongs in a separate assertion.

Add two negative rows. /teams/7/members omits the required member ID. /teams/7/members/4/notes/2/more adds a segment outside this branch. With no other matching route or redirect in your application, mark both as unmatched. Record configured error UI separately. To apply the sheet, open each URL directly, then navigate to it from inside the app and record the actual destination in a fresh column for each entry method.

Expected matches by route depth. The team, member and note identifiers enter the match at different depths. A child cannot supply a missing parent identifier.
The team, member and note identifiers enter the match at different depths. A child cannot supply a missing parent identifier. © gorouter.dev, CC BY 4.0.

go_router configuration and child routes

Find your next route