DarkStatefulShellRoute extension


DarkStatefulShellRoute

Helper to convert a ShellIndexedStackConfig into a full StatefulShellRoute.indexedStack.

WHY YOU NEED THIS

GoRouter's multi-branch layout for bottom navigation looks like this:

StatefulShellRoute.indexedStack(
  branches: [...],
  builder: (context, state, navShell) {
    return Scaffold(...);
  }
);

Instead of writing this by hand for each app:

  • You define a clean config class
  • You pass it to this helper

This keeps your routing layer minimal and all shell logic centralized.

EXAMPLE:

class MainShellConfig extends ShellIndexedStackConfig<MainShellWidget> {
  List<StatefulShellBranch> get branches => [...];

  MainShellWidget routeConfig(GoRouterState state) =>
    MainShellWidget(currentIndex: ...);
}

final router = GoRouter(
  routes: [
    DarkStatefulShellRoute.indexedStackConfig(config: MainShellConfig()),
  ],
);
on
  • StatefulShellRoute

Static Methods

indexedStackConfig<TRouteData extends Widget>({required ShellIndexedStackConfig<TRouteData> config}) → StatefulShellRoute

Available on StatefulShellRoute, provided by the DarkStatefulShellRoute extension

Build a complete StatefulShellRoute.indexedStack from a ShellIndexedStackConfig.