GoRouter.dev

Current field guide · 2026

Build a meaningful route tree

A nested route declares a child destination and can create a matching parent-and-child page stack.

Edition published 21 Oct 2026go_router 18.1.1 reference
On this page

Compose the path

Use a relative child path beneath its parent. In a tree with /books and child :bookId, /books/42 matches both levels. Give each builder a single responsibility so a direct link can reconstruct the intended screens.

Do not confuse nesting with tabs

A nested detail page and an independently stateful tab are different structures. For persistent tabs with separate navigation histories, use StatefulShellRoute. A single nested GoRoute does not by itself create an independent Navigator for every tab.

Decide where the page appears

When a detail must cover the whole application rather than remain inside a shell, select the appropriate parent Navigator key. Keep the keys stable and verify their relationship to the actual shell configuration.

Verify three exits

Test an in-app Back button, system Back on a supported device, and browser Back on the web. Then open the child URL directly. The parent route should still make sense when no prior button click occurred.

dart / example
GoRoute(
  path: '/books',
  builder: (_, __) => const BookListScreen(),
  routes: [
    GoRoute(
      path: ':bookId',
      builder: (_, state) => BookScreen(
        id: state.pathParameters['bookId']!,
      ),
    ),
  ],
)
Earlier edition: read the complete original guide. Its older APIs are kept in historical context.

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.

Find your next route