flutter-go-router-engineering
Installation
SKILL.md
Flutter go_router Engineering
Use go_router as a URL-aware navigation architecture, not as a mechanical replacement for every Navigator call.
Non-negotiable rules
- Inspect the current router, package versions, route tree, keys, redirects, shells, deep-link setup, web strategy, and tests before editing.
- Treat externally visible URLs as compatibility contracts.
- Keep one stable
GoRouterinstance and stable navigator keys. - Keep route builders synchronous, predictable, and cheap.
- Put route-critical identity in path/query data, not only in
extra. - Validate path/query values as external input.
- Keep secrets out of ordinary URLs and route telemetry.
- Use
gofor canonical location changes; usepushonly for intentional stack history. - Use
ShellRoutefor one nested stack under persistent chrome. - Use
StatefulShellRouteonly for genuinely independent branch stacks. - Use
parentNavigatorKeyonly to express intentional Navigator ownership. - Centralize global authentication routing.
- Model auth loading separately from signed-out state.
- Keep redirects deterministic and based on already-available state.
- Do not perform network/database work in redirect callbacks or route builders.
- Keep Bloc/Cubit/domain code independent of
BuildContextandGoRouterwhere practical.