1

I have router with shel route:

final goRouter = GoRouter(
  initialLocation: '/a',
  navigatorKey: _rootNavigatorKey,
  routes: [
    ShellRoute(
      navigatorKey: _shellNavigatorKey,
      builder: (context, state, child) {
        return ScaffoldWithBottomNavBar(child: child);
      },
      routes: [
        GoRoute(
          path: '/a',
          pageBuilder: (context, state) => NoTransitionPage(
            child: const RootScreen(label: 'A'),
          ),
          routes: [
            GoRoute(
              path: 'details',
              builder: (context, state) => const DetailsScreen(label: 'A'),
            ),
          ],
        ),
        GoRoute(
          path: '/b',
          pageBuilder: (context, state) => NoTransitionPage(
            child: const RootScreen(label: 'B'),
          ),
          routes: [
            GoRoute(
              path: 'details',
              builder: (context, state) => const DetailsScreen(label: 'B'),
            ),
          ],
        ),
      ],
    ),
  ],
)

Now, if the state is '/a' and now I want to go to details screen, the right way is context.go('/a/details').

I want just to write ('/details') and the router go to current location (/a) + the new location (/details)

There is a way to do that?

0 Answers0