StatefulShellBranch class

Representation of a separate branch in a stateful navigation tree, used to configure StatefulShellRoute.

The only required argument when creating a StatefulShellBranch is the sub-routes (routes), however sometimes it may be convenient to also provide a initialLocation. The value of this parameter is used when loading the branch for the first time (for instance when switching branch using the goBranch method in StatefulNavigationShell).

A separate Navigator will be built for each StatefulShellBranch in a StatefulShellRoute, and the routes of this branch will be placed onto that Navigator instead of the root Navigator. A custom navigatorKey can be provided when creating a StatefulShellBranch, which can be useful when the Navigator needs to be accessed elsewhere. If no key is provided, a default one will be created.

Annotations

Constructors

StatefulShellBranch({required List<RouteBase> routes, GlobalKey<NavigatorState>? navigatorKey, String? initialLocation, String? restorationScopeId, List<NavigatorObserver>? observers, bool preload = false})
Constructs a StatefulShellBranch.

Properties

defaultRoute → GoRoute?
The default route of this branch, i.e. the first descendant GoRoute.
no setter
hashCode → int
The hash code for this object.
no setterinherited
initialLocation → String?
The initial location for this route branch.
final
The GlobalKey to be used by the Navigator built for this branch.
final
observers → List<NavigatorObserver>?
The observers for this branch.
final
preload → bool
Whether this route branch should be eagerly loaded when navigating to the associated StatefulShellRoute for the first time.
final
restorationScopeId → String?
Restoration ID to save and restore the state of the navigator, including its history.
final
routes → List<RouteBase>
The list of child routes associated with this route branch.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited