StatefulShellRoute.indexedStack constructor

StatefulShellRoute.indexedStack({
  1. required List<StatefulShellBranch> branches,
  2. bool notifyRootObserver = true,
  3. GoRouterRedirect? redirect,
  4. StatefulShellRouteBuilder? builder,
  5. GlobalKey<NavigatorState>? parentNavigatorKey,
  6. StatefulShellRoutePageBuilder? pageBuilder,
  7. String? restorationScopeId,
  8. GlobalKey<StatefulNavigationShellState>? key,
})

Constructs a StatefulShellRoute that uses an IndexedStack for its nested Navigators.

This constructor provides an IndexedStack based implementation for the container (navigatorContainerBuilder) used to manage the Widgets representing the branch Navigators. Apart from that, this constructor works the same way as the default constructor.

See Stateful Nested Navigation for a complete runnable example using StatefulShellRoute.indexedStack.

Applications that rebuild their routing table using GoRouter.routingConfig should provide and reuse key to preserve the shell's page and branch navigator state.

Implementation

StatefulShellRoute.indexedStack({
  required List<StatefulShellBranch> branches,
  bool notifyRootObserver = true,
  GoRouterRedirect? redirect,
  StatefulShellRouteBuilder? builder,
  GlobalKey<NavigatorState>? parentNavigatorKey,
  StatefulShellRoutePageBuilder? pageBuilder,
  String? restorationScopeId,
  GlobalKey<StatefulNavigationShellState>? key,
}) : this(
       branches: branches,
       redirect: redirect,
       builder: builder,
       pageBuilder: pageBuilder,
       notifyRootObserver: notifyRootObserver,
       parentNavigatorKey: parentNavigatorKey,
       restorationScopeId: restorationScopeId,
       navigatorContainerBuilder: _indexedStackContainerBuilder,
       key: key,
     );