Current field guide · 2026
Retain a journey across interruptions
Separate state retained in a live tab from state restored after the application process is recreated.
On this page
Know what you are preserving
An indexed stateful shell can keep separate branch histories during a running session. Restoration after process death needs Flutter's restoration machinery and the relevant restoration IDs. Neither is the same as persisting application data in a database.
Configure scopes deliberately
Consult go_router's State restoration topic for router, shell, branch, and page restoration options. Custom pages need suitable restoration IDs and a compatible page construction strategy.
Keep data independently recoverable
A restored location should still be able to load its resource by identifier. Do not rely on a route extra object being available forever. Model missing, expired, or unauthorized data as normal screen states.
Test the actual lifecycle
Switching tabs tests retention. Restarting the process with the platform's restoration testing procedure tests a different contract. Record which behavior was verified and do not substitute a browser refresh for an Android or iOS restoration test.
GoRouter(
restorationScopeId: 'app-router',
routes: routes,
);
// Add matching restoration configuration to the application,
// shell/branches/pages as required by your route structure.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.