- Home
- Skills
- Hoangnguyen0403
- Agent Skills Standard
- Flutter Navigation
flutter-navigation_skill
- TypeScript
227
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 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 hoangnguyen0403/agent-skills-standard --skill flutter-navigation- SKILL.md1.3 KB
Overview
This skill presents practical guidance for navigation and routing in Flutter apps, emphasizing go_router, deep linking, and named routes. It consolidates patterns, anti-patterns, and operational checks to make navigation predictable, testable, and maintainable. The recommendations target both single-screen flows and multi-tab apps.
How this skill works
The skill recommends using go_router as the primary routing mechanism for declarative, typed routes and built-in redirection. It explains how to configure platform deep links (AndroidManifest.xml and Info.plist), validate parameters in redirect logic, and preserve tab state with IndexedStack. It also highlights anti-patterns to avoid and suggests constants or code generation for route names.
When to use it
- Building new Flutter apps that need a maintainable, declarative routing system.
- Adding deep link support for Android and iOS to open specific screens from URLs.
- Creating multi-tab layouts where preserving tab state is required.
- Migrating from manual Uri parsing or ad-hoc route strings to a consistent routing approach.
- Implementing parameter validation or guarded routes before navigation.
Best practices
- Prefer go_router for modern, declarative routing and redirection hooks.
- Configure deep links in AndroidManifest.xml and Info.plist and test on device.
- Validate route parameters inside redirect or a route-level guard before navigation.
- Preserve tab state with IndexedStack rather than swapping Scaffold bodies.
- Keep route names as constants or use code generation to avoid hardcoded strings.
- Avoid manual Uri.parse-based routing logic; rely on the router’s parsing.
Example use cases
- Protecting a profile route by checking authentication in go_router redirect before pushing the page.
- Handling incoming marketing deep links that open a product detail page with validated product IDs.
- Implementing a bottom navigation with three tabs where each tab keeps its scroll position and internal state.
- Migrating an app that used Navigator.pushNamed with scattered strings to a centralized go_router setup.
- Using named route constants to generate typed route helpers for safer refactoring.
FAQ
Use go_router unless you have highly custom navigator requirements; it builds on Navigator 2.0 and covers most routing, redirection, and deep-link needs with less boilerplate.
How do I prevent losing tab state when switching tabs?
Wrap tab pages in an IndexedStack so inactive tabs remain mounted; avoid replacing the Scaffold body directly as that unmounts and resets state.