GoRouter.dev

Current field guide · 2026

Name a destination once

A named route lets callers refer to a destination without repeating its path template.

Edition published 21 Oct 2026go_router 18.1.1 reference
On this page

Keep names unique

Give a route an unambiguous name, then pass pathParameters when navigating to it. The name identifies the configuration entry; it does not replace a resource identifier such as a book ID.

Use namedLocation when you need a URI string for a link, a redirect, or another API. Supply optional query parameters explicitly. Keep encoded URLs out of handwritten interpolation whenever a routing or URI helper can construct them.

Names are not type checking

A misspelled string or missing parameter can still be an error. For larger route maps, generated type-safe routes can move more mistakes into analysis. That introduces a build step and should match your team's maintenance practices.

Renaming a Dart route name and changing a public URL are different migrations. Even if all internal call sites compile, previously distributed URLs still need a valid destination. Preserve meaningful legacy links when reorganizing your application.

dart / example
GoRoute(
  name: 'book',
  path: '/books/:bookId',
  builder: (_, state) => BookScreen(
    id: state.pathParameters['bookId']!,
  ),
);

context.goNamed('book', pathParameters: {'bookId': '42'});
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