GoRouter.dev

Historical source · 2021–2022

Original guide · Debugging Your Routes

Preserved original documentation, with its original version context.

Edition published 21 Oct 2026Original APIs
On this page
Historical text from the original project repository (2021–2022). For the current APIs, use the 2026 field guide. Original wording and credits are preserved.

Debugging Your Routes

Because go_router asks that you provide a set of paths, sometimes as fragments to match just part of a location, it's hard to know just what routes you have in your app. In those cases, it's handy to be able to see the full paths of the routes you've created as a debugging tool, e.g.

text / example
GoRouter: known full paths for routes:
GoRouter:   => /
GoRouter:   =>   /family/:fid
GoRouter:   =>     /family/:fid/person/:pid
GoRouter: known full paths for route names:
GoRouter:   home => /
GoRouter:   family => /family/:fid
GoRouter:   person => /family/:fid/person/:pid

Likewise, there are multiple ways to navigate, e.g. context.go(), context.goNamed(), context.push(), context.pushNamed(), the Link widget, etc., as well as redirection, so it's handy to be able to see how that's going under the covers, e.g.

text / example
GoRouter: setting initial location /
GoRouter: location changed to /
GoRouter: getting location for name: "person", params: {fid: f2, pid: p1}
GoRouter: going to /family/f2/person/p1
GoRouter: location changed to /family/f2/person/p1

Furthermore, if you use the builder instead of the pageBuilder method to create a screen in your app, go_router will look for the app type to determine what transitions to provide to your pages:

text / example
GoRouter: MaterialApp found

And finally, if there's an exception in your routing, you'll see that in the debug output, too, along with the call stack, e.g.

text / example
GoRouter: Exception: no routes for location: /foobarquux
...call stack elided...

To enable this kind of output when your GoRouter is first created, you can use the debugLogDiagnostics argument:

dart / example
final _router = GoRouter(
  routes: ...,

  // log diagnostic info for your routes
  debugLogDiagnostics: true,
);

This parameter defaults to false, which produces no output.

Sources & version context

GoRouter.dev documentation edition. The preserved text describes the original package APIs. Follow the current guide before using it in a new project.

Find your next route