Navigator constructor

const Navigator({
  1. Key? key,
  2. List<Page> pages = const <Page<dynamic>>[],
  3. @Deprecated('Use onDidRemovePage instead. ' 'This feature was deprecated after v3.16.0-17.0.pre.') PopPageCallback? onPopPage,
  4. String? initialRoute,
  5. RouteListFactory onGenerateInitialRoutes = Navigator.defaultGenerateInitialRoutes,
  6. RouteFactory? onGenerateRoute,
  7. RouteFactory? onUnknownRoute,
  8. TransitionDelegate transitionDelegate = const DefaultTransitionDelegate<dynamic>(),
  9. bool reportsRouteUpdateToEngine = false,
  10. Clip clipBehavior = Clip.hardEdge,
  11. List<NavigatorObserver> observers = const <NavigatorObserver>[],
  12. bool requestFocus = true,
  13. String? restorationScopeId,
  14. TraversalEdgeBehavior routeTraversalEdgeBehavior = kDefaultRouteTraversalEdgeBehavior,
  15. DidRemovePageCallback? onDidRemovePage,
})

Creates a widget that maintains a stack-based history of child widgets.

If the pages is not empty, the onPopPage must not be null.

Implementation

const Navigator({
  super.key,
  this.pages = const <Page<dynamic>>[],
  @Deprecated(
    'Use onDidRemovePage instead. '
    'This feature was deprecated after v3.16.0-17.0.pre.',
  )
  this.onPopPage,
  this.initialRoute,
  this.onGenerateInitialRoutes = Navigator.defaultGenerateInitialRoutes,
  this.onGenerateRoute,
  this.onUnknownRoute,
  this.transitionDelegate = const DefaultTransitionDelegate<dynamic>(),
  this.reportsRouteUpdateToEngine = false,
  this.clipBehavior = Clip.hardEdge,
  this.observers = const <NavigatorObserver>[],
  this.requestFocus = true,
  this.restorationScopeId,
  this.routeTraversalEdgeBehavior = kDefaultRouteTraversalEdgeBehavior,
  this.onDidRemovePage,
});