界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
效率与协作 · SKILL.md

flutter-getx-navigation

flutter-getx-navigation

【效率与协作】Implement context-less navigation, named routes, and middleware using GetX. Use when building navigation with GetX routing in Flutter.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: flutter-getx-navigation description: Implement context-less navigation, named routes, and middleware using GetX. Use when building navigation with GetX routing in Flutter. metadata: triggers: files: - '/app_pages.dart' - '/app_routes.dart' keywords: - GetPage - Get.to - Get.off - Get.offAll - Get.toNamed - GetMiddleware

GetX Navigation

Priority: P0 (CRITICAL)

Guidelines

  • Named Routes: Use Get.toNamed('/path'). Define routes in AppPages.
  • Navigation APIs:
  • Get.to(): Push new route.
  • Get.off(): Replace current route.
  • Get.offAll(): Clear stack and push.
  • Get.back(): Pop route/dialog/bottomSheet.
  • Bindings: Link routes with Bindings for automated lifecycle.
  • Middleware: Implement GetMiddleware for Auth/Permission guards.

Code Example

See AppPages Config for route definition and controller usage patterns.

Anti-Patterns

  • Navigator Context: not use Navigator.of(context) with GetX.
  • Hardcoded Routes: Use Routes constant class.
  • Direct Dialogs: Use Get.dialog() and Get.snackbar().

References

Related Topics

getx-state-management | feature-based-clean-architecture

我的收藏