routing_skill
- Shell
3
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
3 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill yelmuratoff/agent_sync --skill routing- SKILL.md3.0 KB
Overview
This skill helps integrate and manage navigation using go_router in Flutter apps. It focuses on adding screens, deep links, redirects, and type-safe argument passing so navigation stays predictable and testable. The guidance covers setup, routing patterns, and common pitfalls to avoid.
How this skill works
Define a centralized router object and organize routes with nested sub-routes to preserve back navigation and deep-link behavior. Prefer typed route classes (via go_router_builder/@TypedGoRoute) or named routes for safer navigation and parameter handling. Implement redirect logic at the top level or per-route to enforce auth and other guards.
When to use it
- Adding a new screen, feature entry point, or nested section
- Implementing deep links or URL-based navigation for web/mobile
- Enforcing authentication or feature guards with redirects
- Passing arguments between screens while keeping deep links valid
- Refactoring navigation to use typed routes or centralized route names
Best practices
- Centralize router configuration (e.g., core/router or app/router) and prefer nested routes over flat lists
- Use go_router_builder with @TypedGoRoute for type-safe route data; fall back to goNamed with constants if not available
- Pass IDs via path parameters and query parameters for filters; avoid passing large objects in extra unless necessary
- Implement redirect logic to handle auth and special flows; return null when no redirect is required
- Use context.go / context.goNamed for main navigation and context.push / context.pushNamed for transient pages that return results
Example use cases
- Add a product details screen reachable by /products/:id and support direct deep links
- Protect a settings area behind authentication using a top-level redirect/guard
- Implement paginated and filterable lists using query parameters like ?status=paid&page=2
- Navigate from an orders list to an order detail using a typed OrderDetailRoute(id: …).go(context)
- Open a modal or selection sheet with context.push when you need a return value
FAQ
Avoid it when possible. Prefer passing an ID and reloading data so screens are deep-linkable and independent; use extra only for transient state that cannot be refetched.
Where should redirect logic live?
Place auth or global redirect logic at the top-level router or on specific route entries to keep it predictable and centralized.
When to use push vs go?
Use go/goNamed for normal navigation and deep-linkable routes. Use push/pushNamed for transient routes that should return a result on pop.