Router<T>.withConfig constructor
- Key? key,
- required RouterConfig<
T> config, - String? restorationScopeId,
Creates a router with a RouterConfig.
The RouterConfig.routeInformationProvider and RouterConfig.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.
If the RouterConfig.routeInformationProvider is not null, then RouterConfig.routeInformationParser must also not be null.
Implementation
factory Router.withConfig({
Key? key,
required RouterConfig<T> config,
String? restorationScopeId,
}) {
return Router<T>(
key: key,
routeInformationProvider: config.routeInformationProvider,
routeInformationParser: config.routeInformationParser,
routerDelegate: config.routerDelegate,
backButtonDispatcher: config.backButtonDispatcher,
restorationScopeId: restorationScopeId,
);
}