StatefulShellRoute constructor

StatefulShellRoute({
  1. required List<StatefulShellBranch> branches,
  2. GoRouterRedirect? redirect,
  3. StatefulShellRouteBuilder? builder,
  4. StatefulShellRoutePageBuilder? pageBuilder,
  5. required ShellNavigationContainerBuilder navigatorContainerBuilder,
  6. GlobalKey<NavigatorState>? parentNavigatorKey,
  7. String? restorationScopeId,
})

Constructs a StatefulShellRoute from a list of StatefulShellBranches, each representing a separate nested navigation tree (branch).

A separate Navigator will be created for each of the branches, using the navigator key specified in StatefulShellBranch. The Widget implementing the container for the branch Navigators is provided by navigatorContainerBuilder.

Implementation

StatefulShellRoute({
  required this.branches,
  super.redirect,
  this.builder,
  this.pageBuilder,
  required this.navigatorContainerBuilder,
  super.parentNavigatorKey,
  this.restorationScopeId,
})  : assert(branches.isNotEmpty),
      assert((pageBuilder != null) || (builder != null),
          'One of builder or pageBuilder must be provided'),
      assert(_debugUniqueNavigatorKeys(branches).length == branches.length,
          'Navigator keys must be unique'),
      assert(_debugValidateParentNavigatorKeys(branches)),
      assert(_debugValidateRestorationScopeIds(restorationScopeId, branches)),
      super._(routes: _routes(branches));