StatefulShellRoute constructor
StatefulShellRoute({
- required List<
StatefulShellBranch> branches, - GoRouterRedirect? redirect,
- StatefulShellRouteBuilder? builder,
- StatefulShellRoutePageBuilder? pageBuilder,
- String? restorationScopeId,
- GlobalKey<
StatefulNavigationShellState> ? key,
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,
GlobalKey<StatefulNavigationShellState>? key,
}) : 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)),
_shellStateKey = key ?? GlobalKey<StatefulNavigationShellState>(),
super._(routes: _routes(branches));