Flutter GetX Navigation
Installation
SKILL.md
GetX Navigation
Priority: P0 (CRITICAL)
Decoupled navigation system allowing UI transitions without BuildContext.
Implementation Guidelines
- Prefer Named Routes: Use
Get.toNamed('/path')for better maintainability. Define routes in a centralizedAppPagesclass. - No Context Navigation: Leverage
Get.to(),Get.back(), etc., directly from controllers. - Navigation Methods:
Get.to(): Navigate to next screen.Get.off(): Navigate and replace current screen (e.g., Splash -> Home).Get.offAll(): Clear stack and navigate (e.g., Logout -> Login).Get.back(): Close current screen, dialog, or bottom sheet.
- Bindings Everywhere: Always link routes with
Bindingsto manage controller lifecycles. - Middleware: Use
GetMiddlewarefor route guards (Auth, Permissions) instead of logic inside views.