Navigator constructor Null safety
- {Key? key,
- List<
Page> pages = const <Page<dynamic>>[], - PopPageCallback? onPopPage,
- String? initialRoute,
- RouteListFactory onGenerateInitialRoutes = Navigator.defaultGenerateInitialRoutes,
- RouteFactory? onGenerateRoute,
- RouteFactory? onUnknownRoute,
- TransitionDelegate transitionDelegate = const DefaultTransitionDelegate<dynamic>(),
- bool reportsRouteUpdateToEngine = false,
- List<
NavigatorObserver> observers = const <NavigatorObserver>[], - bool requestFocus = true,
- String? restorationScopeId}
Creates a widget that maintains a stack-based history of child widgets.
The onGenerateRoute, pages, onGenerateInitialRoutes, transitionDelegate, observers arguments must not be null.
Implementation
const Navigator({
super.key,
this.pages = const <Page<dynamic>>[],
this.onPopPage,
this.initialRoute,
this.onGenerateInitialRoutes = Navigator.defaultGenerateInitialRoutes,
this.onGenerateRoute,
this.onUnknownRoute,
this.transitionDelegate = const DefaultTransitionDelegate<dynamic>(),
this.reportsRouteUpdateToEngine = false,
this.observers = const <NavigatorObserver>[],
this.requestFocus = true,
this.restorationScopeId,
}) : assert(pages != null),
assert(onGenerateInitialRoutes != null),
assert(transitionDelegate != null),
assert(observers != null),
assert(reportsRouteUpdateToEngine != null);