Current field guide · 2026
Move route mistakes into analysis
Generated route types can replace repeated string construction with typed route objects.
On this page
What type safety changes
Named strings reduce path duplication, but they do not make every parameter compile-time checked. The go_router_builder package generates routing helpers from annotated route-data classes.
Respect the build boundary
Keep declarations and generated code in their expected files, run the documented generator, and include generation in the workflow your team uses. Verify current compatibility between go_router, go_router_builder, build_runner, Dart, and Flutter before updating a project.
Public links still matter
Changing a Dart type name does not need to change a URL. Conversely, a perfectly valid generated route can still break a previously shared link if its path changes. Treat URL migrations separately from code refactors.
The original proposal remains available
This site's early typed-routing article was a proposal. The recovered version is preserved as history. For a new application, follow the current package's Type-safe routes topic and the builder documentation rather than implementing the old proposal literally.
// Route-data classes and generation belong to go_router_builder.
// Use its current installation and generation instructions:
// https://pub.dev/packages/go_router_builder
// Start by modeling required IDs as constructor parameters.
// Keep optional query values explicit and serializable.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.