← ClaudeAtlas

flutter-go-routerlisted

Type-safe routing using go_router + go_router_builder
noory-code/noory-ai · ★ 0 · AI & Automation · score 75
Install: claude install-skill noory-code/noory-ai
# Flutter Go Router Code-generation-based type-safe routing using go_router_builder. --- ## Installation ```bash # required flutter pub add go_router flutter pub add dev:go_router_builder flutter pub add dev:build_runner ``` ## Code Generation ```bash # one-time build dart run build_runner build --delete-conflicting-outputs # watch mode dart run build_runner watch -d ``` --- ## Quick Reference ```dart import 'package:go_router/go_router.dart'; part 'router.g.dart'; // route definition @TypedGoRoute<HomeRoute>( path: '/', routes: [ TypedGoRoute<ProfileRoute>(path: 'profile/:userId'), TypedGoRoute<SettingsRoute>(path: 'settings'), ], ) class HomeRoute extends GoRouteData { const HomeRoute(); @override Widget build(BuildContext context, GoRouterState state) { return const HomeScreen(); } } class ProfileRoute extends GoRouteData { const ProfileRoute({required this.userId}); final String userId; @override Widget build(BuildContext context, GoRouterState state) { return ProfileScreen(userId: userId); } } class SettingsRoute extends GoRouteData { const SettingsRoute(); @override Widget build(BuildContext context, GoRouterState state) { return const SettingsScreen(); } } // GoRouter setup final router = GoRouter(routes: $appRoutes); // App setup class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp.router(routerConfig: router); } } ``` ### Navigation `