← ClaudeAtlas

add-routelisted

Register a screen with AutoRoute — the @RoutePage annotation, router entry, path and naming conventions, route parameters, nested routes, guards, modals and dialogs, and the AppNavigator methods states call. Use when adding a screen to the router, adding a guard, or navigating somewhere new.
NarekManukyan/flutter-mobx-kit · ★ 0 · API & Backend · score 70
Install: claude install-skill NarekManukyan/flutter-mobx-kit
# Add a route Governed by [ADR-0008](../../../docs/adr/0008-appnavigator-routing-abstraction.md). The router lives in `lib/core/navigation/`; guards in `lib/core/guards/`. ## The loop 1. Annotate the page with `@RoutePage()` ([`create-page`](../create-page/SKILL.md)). 2. Run `melos run build` — this generates the `{PageName}Route` class in `app_router.gr.dart`. 3. Add an `AutoRoute` entry to `AppRouter.routes`. 4. Navigate to it from a **state class** via `AppNavigator`. Never from a widget. ## Router entry ```dart @singleton @AutoRouterConfig(replaceInRouteName: 'Page,Route') class AppRouter extends RootStackRouter { @override late final List<AutoRoute> routes = [ AutoRoute( initial: true, path: '/', page: SplashRoute.page, guards: [authGuard], meta: const {'description': 'Splash screen, entry point of the app'}, ), AutoRoute( page: LoginRoute.page, path: '/login-page', meta: const {'description': 'Login page for user authentication'}, ), AutoRoute( path: '/dashboard', page: DashboardRoute.page, children: [ AutoRoute(path: 'agenda', page: AgendaRoute.page), AutoRoute(path: 'meetings', page: MeetingsListRoute.page), ], ), ]; } ``` - `replaceInRouteName: 'Page,Route'` is why `LoginPage` generates `LoginRoute`. Always use the generated class, never a string. - **Paths are kebab-case** and describe the page: `/login-page`, `/sign-up-with-email`. Children us