StatefulNavigationShell class

Widget for managing the state of a StatefulShellRoute.

Normally, this widget is not used directly, but is instead created internally by StatefulShellRoute. However, if a custom container for the branch Navigators is required, StatefulNavigationShell can be used in the builder or pageBuilder methods of StatefulShellRoute to facilitate this. The container is created using the provided ShellNavigationContainerBuilder, where the List of Widgets represent the Navigators for each branch.

Example:

builder: (BuildContext context, GoRouterState state,
    StatefulNavigationShell navigationShell) {
  return StatefulNavigationShell(
    shellRouteState: state,
    containerBuilder: (_, __, List<Widget> children) => MyCustomShell(shellState: state, children: children),
  );
}
Inheritance

Constructors

StatefulNavigationShell({required ShellRouteContext shellRouteContext, required GoRouter router, required ShellNavigationContainerBuilder containerBuilder})
Constructs an StatefulNavigationShell.

Properties

containerBuilder ShellNavigationContainerBuilder
The builder for a custom container for shell route Navigators.
final
currentIndex int
The index of the currently active StatefulShellBranch.
final
debugLoadedBranches List<StatefulShellBranch>
Checks if the provided branch is loaded (i.e. has navigation state associated with it).
no setter
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
route StatefulShellRoute
The associated StatefulShellRoute.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shellRouteContext ShellRouteContext
The ShellRouteContext responsible for building the Navigator for the current StatefulShellBranch.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<StatefulWidget>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
goBranch(int index, {bool initialLocation = false}) → void
Navigate to the last location of the StatefulShellBranch at the provided index in the associated StatefulShellBranch.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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

Static Methods

maybeOf(BuildContext context) StatefulNavigationShellState?
Gets the state for the nearest stateful shell route in the Widget tree.
of(BuildContext context) StatefulNavigationShellState
Gets the state for the nearest stateful shell route in the Widget tree.