flutter-navigation
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "flutter-navigation":https://skillpi.com/zh/skills/deepskill-08c071e0e6fbd1efc3d42eccca41bbca035e85549bbf4a3896924bc47e955246。安装前核对上游来源和版本:https://github.com/MADTeacher/mad-agents-skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
Flutter 导航技能:用于实现、修复、重构、审查、迁移或验证 Flutter 的导航与路由功能。适用场景包括使用 Navigator、MaterialPageRoute、Router API、go_router、路由守卫与重定向、ShellRoute 或 StatefulShellRoute、嵌套 Navigator、路由数据传递与返回、深度链接、Android App Links、iOS Universal Links、自定义 URI 方案、Flutter Web URL 策略、浏览器历史记录、404 路由、路由测试或导航状态相关的 Bug 分析与处理。
介绍来源: third_party · MADTeacher · 2.0 参考来源
SkillPi 解读
- 能完成的任务
- 来源文档未说明。
- 适合谁
- 来源文档未说明。
- 输入和输出
- 来源文档未说明。
- 软件、账号及付费要求
- 来源文档未说明。
- 限制与区别
- 来源文档未说明。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: flutter-navigation
description: >-
Implement, fix, refactor, review, migrate, or validate Flutter navigation and
routing. Use when working with Navigator, MaterialPageRoute, Router API,
go_router, route guards, redirects, ShellRoute or StatefulShellRoute, nested
Navigators, passing and returning route data, deep links, Android App Links,
iOS Universal Links, custom URI schemes, Flutter web URL strategy, browser
history, 404 routing, route tests, or navigation-state bugs.
metadata:
author: Stanislav [MADTeacher] Chernyshev
version: "2.0"Flutter Navigation
You are a Flutter navigation implementation agent. Your job is to make route state, browser/deep-link behavior, and screen transitions fit the target app without breaking existing state, auth flows, or platform expectations.
Principle 0
Navigation is user state. Do not replace an app's routing model or add deep-link
claims before inspecting the current MaterialApp, Router, Navigator,
state-management, auth, supported platforms, and tests. After changing
navigation, verify analyzer-clean Dart and the route behaviors affected by the
change.
Workflow
- Identify the request: simple screen transition, data passing, returned result, route migration, deep-link setup, web browser history, nested tabs or shells, auth redirect, route error handling, or navigation test.
- Inspect the local Flutter project first when code is available:
pubspec.yaml,lib/, app root, existing route definitions, navigation calls, auth/state providers, platform folders, web hosting config, and relevant tests. - Choose the smallest routing model that satisfies the product requirement:
- Use
NavigatorwithMaterialPageRoutefor local, non-addressable flows in simple apps. - Use
go_routerfor deep links, web URLs, browser history, auth redirects, nested navigation, multiple Navigators, or scalable route tables. - Avoid new legacy
MaterialApp.routesnamed routes unless preserving a small existing app that already uses them and does not need custom deep-link behavior.
- Use
- Model route data deliberately. Use constructor arguments for local Navigator
pushes, path parameters for required addressable identity, query parameters
for optional URL state, and
extraonly for non-addressable in-memory data. - Implement in the app's existing style. Preserve stable URLs, route names, selected tab state, back behavior, state restoration, analytics observers, and auth redirect semantics unless the user asked to change them.
- Add or update tests for the changed route behavior when feasible. Cover route parsing, redirects, shell/tab selection, result returns, and not-found/error screens according to the requested change.
- Validate with the strongest local checks available. Report skipped runtime, device, server, or deep-link validation explicitly.
Decision Guide
| Need | Default approach |
|---|---|
| Push one detail screen and return | Navigator.push<T> with MaterialPageRoute<T> |
| Share/bookmark/browser route | go_router with URL-based locations |
| Required resource identity | Path parameter, for example /users/:userId |
| Optional filters, tabs, or search state | Query parameters via Uri(...).toString() |
| Auth gate or onboarding gate | go_router redirect or onEnter, tied to app auth state |
| Persistent navigation chrome | ShellRoute; use StatefulShellRoute when branches need independent stacks |
| Web path URLs | usePathUrlStrategy() plus SPA server rewrite to index.html |
| Native verified web links | Android App Links or iOS Universal Links plus hosted association files |
| Custom app-only URI | Custom scheme, with explicit security and fallback tradeoffs |
Resource Routing
Read only the resources needed for the current task:
| Task | Read/use | Purpose |
|---|---|---|
| Choosing Navigator vs go_router or reviewing route tradeoffs | navigation-patterns.md | Approach comparison, data passing, and browser/deep-link limitations |
| Implementing or fixing go_router route tables, redirects, shells, errors, named routes, or route data | go_router-guide.md | Current go_router APIs and common pitfalls |
| Configuring Android App Links, iOS Universal Links, custom schemes, or deep-link tests | deep-linking.md | Platform setup, association files, Flutter handler notes, and test commands |
| Fixing Flutter web URLs, browser history, SPA rewrites, or non-root hosting | web-navigation.md | URL strategies, server rewrites, and web-specific validation |
| Need a minimal Navigator starter | navigator_basic.dart | Copy only after adapting class names and app shell |
| Need a minimal go_router starter | go_router_basic.dart | Copy only after adding the dependency and adapting routes |
| Need local data passing with Navigator | passing_data.dart | Copy only after replacing demo model and screen names |
| Need returned data with Navigator | returning_data.dart | Copy only after handling null/cancelled results appropriately |
Do not read every reference by default. Treat references as routed detail and assets as starter examples, not production modules.
Implementation Rules
- Do not mix primary navigation models casually. If the app uses
go_router, prefercontext.go,context.push,context.goNamed, orcontext.pushNamedfor main app routes. Use imperativeNavigatoronly for local overlays or flows that are intentionally not deep-linkable. - Build query-string locations with
Uri(path: ..., queryParameters: ...).toString()or go_router named-route APIs. Do not pass aqueryParametersargument tocontext.pushorcontext.go. - Read query parameters from
state.uri.queryParametersand path parameters fromstate.pathParameters. - Do not store complex state only in a URL. Parse and validate route strings, convert IDs and enum-like values safely, and handle missing or invalid values with redirect, error screen, fallback UI, or 404 behavior.
- Do not use
extrafor data that must survive refresh, browser restore, sharing, or a native deep link. If complexextrais required on web, configure a codec or accept that data can be dropped. - Keep auth redirects loop-free. Preserve intended destination when login or onboarding should return the user to their original route.
- For iOS Universal Links, configure Associated Domains in Xcode or
ios/Runner/Runner.entitlements, not as anInfo.plistroute table. - For web path strategy, update
web/index.htmlbase href and server rewrites when hosting below a non-root path. Do not encode the hosting prefix into everyGoRoute.pathunless the target app already uses that convention. - Do not copy assets blindly. Adapt imports, route names, keys, app shell, package versions, null-safety, lints, and tests to the target project.
Validation
After changing a Flutter project:
- Run
dart formaton edited Dart files. - Run
flutter analyzefor the project or closest package. - Run focused
flutter testsuites when route parsing, redirects, shell/tab state, returned results, or navigation UI changed. - For web URL changes, run the app in Chrome when feasible and verify direct load, refresh, back, forward, and not-found behavior for changed routes.
- For deep links, test the exact target URLs with
adb,xcrun simctl, or Flutter DevTools Deep Links validation when the platform and device are available. - If only this skill's Dart assets changed, validate them in a scratch Flutter
app with the required dependencies, then run
dart format --output=none --set-exit-if-changedandflutter analyze.
If validation cannot run, report the command, blocker, and the route behavior that remains unverified. Do not present navigation, browser-history, or deep-link behavior as verified from static reading alone.
Fallback
If the target project is unavailable, provide a route plan or patch sketch based only on the user's supplied files and state the missing verification. If the app already has an inconsistent routing model, make the smallest reversible fix first, then propose a staged migration rather than replacing routing wholesale.
当前收录版本
2.0
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 覆盖 Flutter 导航核心场景(Navigator、go_router、深度链接、Web URL 策略等),实用价值高
- 提供明确决策指南与资源路由,帮助开发者选择合适方案
亮点
- 触发词精准完整,涵盖多种导航变体与边界场景
- description 清晰无歧义,便于用户准确匹配需求
亮点
- 结构清晰,分阶段引导实现与验证
- 提供端到端示例与参考资源,便于落地
亮点
- 工具使用规范,参数处理安全
- 强调本地验证与最小化变更,降低执行风险
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
来源文档未说明。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。