Current field guide · 2026
Give every tab its own journey
Use StatefulShellRoute when parallel destinations need independent navigation histories and retained branch state.
On this page
Choose the kind of shell
ShellRoute wraps matching content in a persistent frame. StatefulShellRoute goes further by providing separate Navigators for its branches. Its indexedStack constructor supplies the standard branch-container behavior.
Keep the shell outside the branch
Your shell widget renders the supplied StatefulNavigationShell and uses its currentIndex for the selected navigation item. Call goBranch to switch the active branch rather than manually rebuilding all tab screens.
Decide what reselection means
Tapping an already active tab can preserve its current detail or return to its initial location. Specify that behavior intentionally. Test whether scroll positions, form state, and detail stacks match what users expect.
Test a direct child URL
A browser can open a nested tab destination before any tab has been selected. The route map should select the correct branch and build a useful shell. State restoration across process death is a further concern; retained branch state within a running session does not automatically solve it.
StatefulShellRoute.indexedStack(
builder: (context, state, navigationShell) => AppShell(
navigationShell: navigationShell,
),
branches: [
StatefulShellBranch(routes: [
GoRoute(path: '/books', builder: (_, __) => const Books()),
]),
StatefulShellBranch(routes: [
GoRoute(path: '/saved', builder: (_, __) => const Saved()),
]),
],
)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.