GoRouter.dev

Current field guide · 2026

Make Back feel inevitable

Test browser history as part of your navigation contract rather than assuming it mirrors a mobile stack.

Edition published 21 Oct 2026go_router 18.1.1 reference
On this page

Keep durable state in the URI

A shared link should identify enough state to rebuild a useful screen. Objects passed only through process memory are not a reliable contract for a new browser tab. Give resources identifiers and make query-based filters reconstructible.

Distinguish operations

Destination navigation and imperative pushes have different implications for browser history. Consult the Navigation topic for your package version and exercise the actual sequence of actions your interface offers.

Use history suppression sparingly

Router.neglect can perform navigation without the usual browser-history recording behavior. It is useful only when that matches the intended user experience. Suppressing history broadly can make a website's Back button feel broken.

Keep a regression sequence

Open A, navigate to B, change a filter, press Back twice, press Forward, and reload. Record the expected URI and visible screen after each step. Repeat for a direct nested link and a signed-out entry.

dart / example
Router.neglect(context, () {
  context.go('/books?sort=recent');
});

// Use only when omitting this history entry is intentional.
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