go_router
The official Flutter navigation library (Google-maintained, part of flutter/packages). go_router provides URL-based declarative routing for Flutter with deep linking, nested navigation, parameterized routes, and redirect support. Replaces Flutter's imperative Navigator 1.0 push/pop API with a URL-driven Router 2.0 approach — routes are defined as a tree, navigation is done with context.go('/path') or context.push('/path').
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Client-side routing library — no network exposure. Route guards via redirect prevent unauthorized access. Deep link validation should check source before processing.
⚡ Reliability
Best When
You're building a non-trivial Flutter app and need URL-based routing, deep linking, or authentication guards — go_router is the official recommended Flutter routing solution.
Avoid When
Your Flutter app is simple with 2-3 screens and no deep linking needs — Navigator.push/pop is simpler. go_router adds configuration overhead for simple apps.
Use Cases
- • Define type-safe URL routes for Flutter agent apps with parameterized paths — go_router parses path params (/agent/:id) and query params automatically
- • Implement deep linking in Flutter apps so agent workflow URLs (yourapp://workflow/123) navigate directly to the correct screen
- • Add authentication guards using go_router redirect callbacks that check auth state and redirect unauthenticated users to login
- • Build nested navigation with ShellRoute for Flutter apps that have bottom navigation bars with independent navigation stacks per tab
- • Generate typed route classes using go_router_builder code generation — compile-time safe route parameters instead of string paths
Not For
- • Flutter Web apps with complex browser history requirements — go_router handles basic browser history but complex web navigation may need custom history management
- • Apps still on Navigator 1.0 that aren't migrating — go_router requires Router 2.0 setup; not a drop-in replacement without refactoring
- • React Native or other non-Flutter frameworks — React Navigation is the equivalent for React Native
Interface
Authentication
go_router is a routing library — authentication state is checked in redirect callbacks. Common pattern: redirect to '/login' if auth provider state is unauthenticated.
Pricing
go_router is maintained by Google as part of flutter/packages and is BSD-3-Clause licensed. Free for all use.
Agent Metadata
Known Gotchas
- ⚠ context.go vs context.push semantics — go() replaces the entire navigation stack to the new route, push() adds to the stack; using go() where push() is intended loses back navigation history
- ⚠ Redirect loops — if redirect callback redirects based on state that the redirect destination also redirects from, infinite loops occur; always ensure redirect destination has no further redirects
- ⚠ Nested routes require matching parent path prefix — child routes must include parent path: '/parent/child', not just '/child'; route tree mismatches cause NoRoutesException
- ⚠ GoRouter is a widget and must be provided to MaterialApp.router — using MaterialApp (non-router) with go_router causes context.go to fail silently or throw
- ⚠ StatefulShellRoute replaces Navigator 1.0 IndexedStack pattern — migrating bottom nav apps from imperative to go_router requires replacing IndexedStack with StatefulShellRoute branches
- ⚠ go_router_builder code gen requires running build_runner — forgetting to regenerate typed routes after adding new GoRoute definitions causes compile errors in generated code
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for go_router.
Scores are editorial opinions as of 2026-03-06.