← スキル一覧に戻る

flutter-getx-navigation
by HoangNguyen0403
flutter-getx-navigationは、other分野における実用的なスキルです。複雑な課題への対応力を強化し、業務効率と成果の質を改善します。
⭐ 111🍴 40📅 2026年1月23日
SKILL.md
name: Flutter GetX Navigation description: Context-less navigation, named routes, and middleware using GetX. metadata: labels: [navigation, getx, routing, middleware] triggers: files: ['/app_pages.dart', '/app_routes.dart'] keywords: [GetPage, Get.to, Get.off, Get.offAll, Get.toNamed, GetMiddleware]
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.
Code Example
// Route Definition
static final routes = [
GetPage(
name: _Paths.HOME,
page: () => HomeView(),
binding: HomeBinding(),
middlewares: [AuthMiddleware()],
),
];
// Usage in Controller
void logout() {
_authService.clear();
Get.offAllNamed(Routes.LOGIN);
}
// Route Guard
class AuthMiddleware extends GetMiddleware {
@override
RouteSettings? redirect(String? route) {
return isAuthenticated ? null : RouteSettings(name: Routes.LOGIN);
}
}
Anti-Patterns
- Mixing Context and GetX: Do not use
Navigator.of(context)when GetX is the primary router. - Hardcoded Strings: Always use a
Routesconstant class for names. - Dialogs without GetX: Use
Get.dialog()andGet.snackbar()for consistency.
Reference & Examples
For centralized route configuration and middleware guards: See references/app-pages.md and references/middleware-example.md.
Related Topics
getx-state-management | feature-based-clean-architecture
スコア
総合スコア
85/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
✓説明文
100文字以上の説明がある
+10
✓人気
GitHub Stars 100以上
+5
✓最近の活動
1ヶ月以内に更新
+10
✓フォーク
10回以上フォークされている
+5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
✓タグ
1つ以上のタグが設定されている
+5
レビュー
💬
レビュー機能は近日公開予定です

