Router<T> constructor
Null safety
- {Key? key,
- RouteInformationProvider? routeInformationProvider,
- RouteInformationParser<
T> ? routeInformationParser, - required RouterDelegate<
T> routerDelegate, - BackButtonDispatcher? backButtonDispatcher,
- String? restorationScopeId}
Creates a router.
The routeInformationProvider and routeInformationParser can be null if this router does not depend on route information. A common example is a sub router that builds its content completely based on the app state.
The routeInformationProvider and routeInformationParser must both be provided or not provided.
The routerDelegate must not be null.
Implementation
const Router({
super.key,
this.routeInformationProvider,
this.routeInformationParser,
required this.routerDelegate,
this.backButtonDispatcher,
this.restorationScopeId,
}) : assert(
routeInformationProvider == null || routeInformationParser != null,
'A routeInformationParser must be provided when a routeInformationProvider is specified.',
),
assert(routerDelegate != null);