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.
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.
Router.neglect(context, () {
context.go('/books?sort=recent');
});
// Use only when omitting this history entry is intentional.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.