Typed Routes: Always use GoRouteData and @TypedGoRoute from go_router_builder. Never
use raw path strings.
Parameters: Define strongly-typed parameters in the route class (e.g.,
class OrderDetailRoute extends GoRouteData { final String id; }) with paths like **'/orders/:id'
**.
Root Router: One global GoRouter instance registered in DI.
Sub-Routes: Nest related routes using TypedGoRoute and children lists.
Redirection: Handle Auth (Login check) in the redirect callback of the GoRouter config:
redirect: (context, state) => isLoggedIn ? null : '/login'. Do NOT check auth inside the page
widget.
Tabs: Use StatefulShellRoute with branches for a bottom tab bar (Home, Orders, Profile) so
each tab maintains its own navigation stack.
Transitions: Define standard transitions (Fade, Slide) in buildPage.
Navigation: Use MyRoute().go(context) or MyRoute().push(context). Using *
OrderDetailRoute(id: id).go(context)* is the only allowed way to navigate.
Code
See references/typed-routes.md for GoRouteData + redirect
implementation.
Anti-Patterns
❌ context.go('/orders/123') with a raw string path — always use typed GoRouteData classes (
e.g., OrderDetailRoute(id: 123).go(context))
❌ Auth check inside the page widget's build() — redirect logic belongs in the
GoRouter.redirect callback, not the UI
❌ Multiple GoRouter instances — register one global instance in DI and share it throughout the
app
❌ Navigating to a deep link without validating the ID in redirect — always verify IDs/parameters
exist before building the route
1---2name: li-lance-android-seraphim-framework-flutter-go-router-naviga3description: GoRouter Navigation4---56# GoRouter Navigation78## **Priority: P0 (CRITICAL)**910Type-safe deep linking and routing system using `go_router` and `go_router_builder`.1112## Structure1314```text15core/router/16├── app_router.dart # Router configuration17└── routes.dart # Typed route definitions (GoRouteData)18```1920## Implementation Guidelines2122- **Typed Routes**: Always use **GoRouteData** and **@TypedGoRoute** from `go_router_builder`. Never23 use raw path strings.24- **Parameters**: Define strongly-typed parameters in the route class (e.g.,25 `class OrderDetailRoute extends GoRouteData { final String id; }`) with paths like **'/orders/:id'26 **.27- **Root Router**: One global `GoRouter` instance registered in DI.28- **Sub-Routes**: Nest related routes using `TypedGoRoute` and children lists.29- **Redirection**: Handle Auth (Login check) in the **redirect callback** of the `GoRouter` config:30 `redirect: (context, state) => isLoggedIn ? null : '/login'`. **Do NOT check auth inside the page31 widget.**32- **Tabs**: Use **StatefulShellRoute** with branches for a bottom tab bar (Home, Orders, Profile) so33 each tab maintains its own navigation stack.34- **Transitions**: Define standard transitions (Fade, Slide) in `buildPage`.35- **Navigation**: Use **MyRoute().go(context)** or `MyRoute().push(context)`. Using *36 *OrderDetailRoute(id: id).go(context)** is the only allowed way to navigate.3738## Code3940See [references/typed-routes.md](references/typed-routes.md) for GoRouteData + redirect41implementation.4243## Anti-Patterns4445- ❌ `context.go('/orders/123')` with a raw string path — always use typed `GoRouteData` classes (46 e.g., `OrderDetailRoute(id: 123).go(context)`)47- ❌ Auth check inside the page widget's `build()` — redirect logic belongs in the48 `GoRouter.redirect` callback, not the UI49- ❌ Multiple `GoRouter` instances — register one global instance in DI and share it throughout the50 app51- ❌ Navigating to a deep link without validating the ID in `redirect` — always verify IDs/parameters52 exist before building the route5354## Related Topics5556layer-based-clean-architecture | auto-route-navigation | security5758---59> Source: [li-lance/android-seraphim-framework](https://github.com/li-lance/android-seraphim-framework) — distributed by [TomeVault](https://tomevault.io).60<!-- tomevault:4.0:skill_md:2026-06-16 -->
Run npx skillmds@latest add tomevault-io/li-lance-android-seraphim-framework-flutter-go-router-naviga in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
GoRouter Navigation It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
tomevault-io (@tomevault-io) published this skill. Their other Agent Skills are listed on their SkillMD profile.