AdvancedNavigator class

A widget that manages a set of child widgets with a stack discipline.

This widget wraps a Router and Navigator object for maintaining a full

AdvancedNavigator(
  pages: {
    'projects': (_) => MaterialPage(child: ViewHome()),
    'settings': (_) => MaterialPage(child: ViewSettings()),
    'editor': (args) => MaterialPage(child: ViewProject(args['projectId'])),
  },
  paths: {
    '/': (_) => [
      MaterialPage(child: ViewHome()),
    ],
    '/projects': (_) => [
      MaterialPage(child: ViewHome()),
    ],
    '/projects/{projecId}': (args) => [
      MaterialPage(child: ViewHome()),
      MaterialPage(child: ViewProject(args['projectId'])),
    ],
    '/settings': (_) => [
      MaterialPage(child: ViewHome()),
      MaterialPage(child: ViewSettings()),
    ],
  },
  onGeneratePath: (configuration) {
    // fallback for paths
  },
  onUnknownPath: (configuration) {
    // fallback for onGeneratePath
  },
);
Inheritance

Constructors

AdvancedNavigator({Key? key, AdvancedNavigatorState? parent, String? initialLocation, Map<String, List<Page> Function(PathArguments)> paths = const {}, PathFactory? onGeneratePath, PathFactory? onUnknownPath, Map<String, Page Function(Object?)> pages = const {}, PageFactory? onGeneratePage, PageFactory? onUnknownPage, PopPageCallback? onPopPage, Map<String, Route>? routes, RouteFactory? onGenerateRoute, RouteFactory? onUnknownRoute, BackButtonDispatcher? backButtonDispatcher, TransitionDelegate transitionDelegate = const DefaultTransitionDelegate<dynamic>(), bool reportsRouteUpdateToEngine = false, List<NavigatorObserver> observers = const <NavigatorObserver>[], String? restorationScopeId, String? tag})

Properties

backButtonDispatcher BackButtonDispatcher?
final
hashCode int
The hash code for this object.
no setterinherited
initialLocation String?
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
observers List<NavigatorObserver>
final
onGeneratePage PageFactory?
final
onGeneratePath PathFactory?
final
onGenerateRoute RouteFactory?
final
onPopPage PopPageCallback?
final
onUnknownPage PageFactory?
final
onUnknownPath PathFactory?
final
onUnknownRoute RouteFactory?
final
pages Map<String, Page Function(Object?)>
final
parent AdvancedNavigatorState?
The navigator instance to which all navigation events from this navigator will be reported.
final
paths Map<String, List<Page> Function(PathArguments)>
final
reportsRouteUpdateToEngine bool
final
restorationScopeId String?
final
routes Map<String, Route>?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tag String?
final
transitionDelegate TransitionDelegate
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
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}) 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 Properties

argPattern RegExp
Pattern for detecting parameters in a path name.
getter/setter pair
nestPattern RegExp
Pattern for detecting whether a path name can have nested path names appended to it.
getter/setter pair

Static Methods

attach<T extends Object>(BuildContext context, Route<T> route) Future<T?>
attachNamed<T extends Object>(BuildContext context, String name, {Object? arguments}) Future<T?>
maybeOf(BuildContext context, {bool rootNavigator = false, int skip = 0, String? tag}) AdvancedNavigatorState?
The navigator state from the closest instance of this class that encloses the given context, if any.
of(BuildContext context, {bool rootNavigator = false, int skip = 0, String? tag}) AdvancedNavigatorState
The router delegate from the closest instance of this class that encloses the given context.
open(BuildContext context, List<Page> pages, {Object? state}) → void
openNamed(BuildContext context, String location, {Object? state, Object? arguments}) Future<void>
parsePath(String path) PathGroup
Function for parsing a string path to a PathGroup object.
pop<T extends Object>(BuildContext context, [T? result]) → void
Pop the top-most route off the navigator that most tightly encloses the given context.
push<T extends Object>(BuildContext context, Page<T> page) Future<T?>
pushNamed<T extends Object>(BuildContext context, String name, {Object? arguments}) Future<T?>

Constants

defaultPathName → const String