iamantoniodinuzzo/claude-flutter/flutter-go-router
Claude Code and agent skill by iamantoniodinuzzo/claude-flutter
- community
Checking that the SKILL.md file is still in the repository.
Use when implementing, reviewing, or debugging navigation in Flutter apps that use go_router — routes, guards, shell navigation, type-safe routes, deep linking, nested navigators, or bottom nav persistence.
Install
npx vskill@latest install iamantoniodinuzzo/claude-flutter/flutter-go-routerSKILL.md
The same SKILL.md was published earlier as iamantoniodinuzzo/claude-flutter/flutter-go-router.
Flutter GoRouter Navigation
Runtime and resources
Use the current agent's native file, search, shell, and question tools; plain-text questions and direct sequential scans are valid fallbacks. Subagents are optional and require host permission. Bundled paths below are relative to this installed skill directory; application paths are relative to the target Flutter project. Resolve sibling skills through the installed skill registry (or sibling directories), never by assuming a skills/ folder in the application. If a required dependency is absent, name it and report the affected step as unavailable; never invent its rules or claim complete coverage.
Overview
GoRouter is Flutter's declarative, URL-based router built on the Router API. Core rule: routes define structure; `go()` replaces stack, `push()` adds to it.
Route Types
| Type | Use case | |
|---|---|---|
GoRoute | Standard screen/page | |
ShellRoute | Persistent UI wrapper (e.g. BottomNavigationBar) — stateless | |
StatefulShellRoute | Persistent shell with independent navigation stacks per branch |
Setup
With Riverpod:
Navigation Methods
Path & Query Parameters
URL-Driven Tab / Query-Param State
Replace a Riverpod/Provider tab state with the URL as the single source of truth.
Rule: if the state can live in the URL → it should. Enables deep links, browser back, bookmarking for free.
Reading — anywhere in the widget tree
Writing — navigate to change tab
Gotcha:context.go()has noqueryParametersnamed param — inline only.context.goNamed()has it. Both approaches work; pick one per call-site.
Syncing TabController to URL (didUpdateWidget)
When a TabController lives alongside URL routing, sync it when the URL changes externally (browser back, deep link):
Calling go() from ref.listen (Riverpod)
Navigating in response to a provider change (e.g. permissions revoked → redirect to fallback tab):
Why addPostFrameCallback:ref.listenfires during build; callinggo()mid-build triggers a router rebuild conflict. Post-frame callback avoids this.
Redirects / Auth Guard
Route-level redirect (runs after top-level):
Shell Navigation (Bottom Nav)
Stateless shell (shared state lost on tab switch)
Stateful shell (independent stacks per tab, state preserved)
Rule: useStatefulShellRoutewhen users expect tab state to persist (scroll position, sub-routes, forms).
Type-Safe Routes (recommended for large apps)
Requires go_router_builder + build_runner.
Extra (non-URL) objects: declare as final MyObject $extra; — not URL-serialized, lost on deep link.
Nested Sub-Routes
Page Transitions
Decide transitions once, in the theme — not per route. A page built with NoTransitionPage never asks ThemeData.pageTransitionsTheme, so a blanket _page(child) => NoTransitionPage(child: child) helper (usually added to stop web slide animations) also removes native Android/iOS transitions and makes any theme setting a no-op. Use plain MaterialPage (or builder:) on routes and set an adaptive theme:
- Apply it to both light and dark
ThemeData(pageTransitionsTheme: appPageTransitionsTheme). - Keep an explicit
NoTransitionPage/CustomTransitionPageonly for deliberate one-offs (e.g. a full-screen cockpit). StatefulShellRoute.indexedStack: branch switches never animate; only pushes inside a branch do.- Android 14+:
PredictiveBackPageTransitionsBuildercan replaceZoomPageTransitionsBuilder. - Generate and wire this automatically with
/page-transitions-init(theme file, light + dark wiring, opt-in router migration). - Audited by ROUTER-03 (
audit-presentation-layer); full write-up in itsgo-router-navigation-conventions.md§8.
Deep Linking
Android (AndroidManifest.xml): add <intent-filter> with android.intent.action.VIEW for your scheme/host.
iOS (Info.plist): add CFBundleURLSchemes or Associated Domains for universal links.
GoRouter handles the URL → route matching automatically.
Common Mistakes
| Mistake | Fix | |
|---|---|---|
go() when you need back button | use push() | |
pop() without canPop() check | always guard with if (context.canPop()) | |
Passing extra and expecting it on deep link | use URL params for deep-linkable data | |
Missing refreshListenable with Riverpod | add RouterNotifier to re-run redirects | |
ShellRoute when tab state must persist | use StatefulShellRoute | |
| Named routes with wrong param key | verify key matches :param name in path | |
context.go('/path', queryParameters: {...}) | not valid — inline: context.go('/path?k=v') or use goNamed | |
| Riverpod provider for tab state when URL can hold it | use GoRouterState.of(context).uri.queryParameters instead | |
Calling context.go() inside ref.listen directly | wrap in addPostFrameCallback + context.mounted guard | |
Blanket NoTransitionPage helper on every route | kills native mobile transitions and bypasses pageTransitionsTheme — use MaterialPage + adaptive theme (ROUTER-03) |
Adding a SentryNavigatorObserver
When the project uses the sentry-init skill, add SentryNavigatorObserver to the GoRouter constructor — not to MaterialApp.router (which has no navigatorObservers argument):
For Riverpod-wrapped router:
Observer is only useful with named routes (add name: to each GoRoute). See ../sentry-init for full Sentry integration instructions.
Quick Decision Tree
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 98 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/flutter-go-router/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/iamantoniodinuzzo/claude-flutter/flutter-go-router)