Agent-skills-standard flutter-auto-route-navigation
Implement typed routing, nested routes, and guards using auto_route. Use when adding typed navigation, nested routes, or route guards with auto_route in Flutter. (triggers: **/router.dart, **/app_router.dart, AutoRoute, AutoRouter, router, guards, navigate, push)
install
source · Clone the upstream repo
git clone https://github.com/HoangNguyen0403/agent-skills-standard
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/HoangNguyen0403/agent-skills-standard "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/flutter/flutter-auto-route-navigation" ~/.claude/skills/hoangnguyen0403-agent-skills-standard-flutter-auto-route-navigation && rm -rf "$T"
manifest:
skills/flutter/flutter-auto-route-navigation/SKILL.mdsource content
AutoRoute Navigation
Priority: P1 (HIGH)
Structure
core/router/ ├── app_router.dart # Router configuration └── app_router.gr.dart # Generated routes
Implementation Workflow
- Annotate pages — Mark all screen/page widgets with
.@RoutePage() - Configure router — Extend
and annotate with_$AppRouter
.@AutoRouterConfig - Navigate with types — Use generated route classes (e.g.,
). Never use strings.HomeRoute() - Add guards — Implement
for authentication/authorization logic.AutoRouteGuard - Handle parameters — Constructors of
widgets automatically become route parameters.@RoutePage - Prefer declarative calls — Use
orcontext.pushRoute()
.context.replaceRoute()
Nested Routes & Tabs
Use
children in AutoRoute for tabs. Pass children parameter to define initial active sub-route.
See implementation examples for nested route navigation and router configuration patterns.
Reference & Examples
For full Router configuration and Auth Guard implementation: See references/REFERENCE.md.
Anti-Patterns
- No string-based navigation: Use generated typed route classes (e.g.,
).OrderDetailRoute(id: 123) - No protected screen without AutoRouteGuard: Every protected route must declare guard; don't rely on UI-level checks.
- No navigation calls from BLoC: Emit state and let Presentation layer navigate.