WidgetsApp.router constructor Null safety
- {Key? key,
- RouteInformationProvider? routeInformationProvider,
- RouteInformationParser<
Object> ? routeInformationParser, - RouterDelegate<
Object> ? routerDelegate, - RouterConfig<
Object> ? routerConfig, - BackButtonDispatcher? backButtonDispatcher,
- TransitionBuilder? builder,
- String title = '',
- GenerateAppTitle? onGenerateTitle,
- TextStyle? textStyle,
- required Color color,
- Locale? locale,
- Iterable<
LocalizationsDelegate> ? localizationsDelegates, - LocaleListResolutionCallback? localeListResolutionCallback,
- LocaleResolutionCallback? localeResolutionCallback,
- Iterable<
Locale> supportedLocales = const <Locale>[Locale('en', 'US')], - bool showPerformanceOverlay = false,
- bool checkerboardRasterCacheImages = false,
- bool checkerboardOffscreenLayers = false,
- bool showSemanticsDebugger = false,
- bool debugShowWidgetInspector = false,
- bool debugShowCheckedModeBanner = true,
- InspectorSelectButtonBuilder? inspectorSelectButtonBuilder,
- Map<
ShortcutActivator, Intent> ? shortcuts, - Map<
Type, Action< ? actions,Intent> > - String? restorationScopeId,
- bool useInheritedMediaQuery = false}
Creates a WidgetsApp that uses the Router instead of a Navigator.
If the routerConfig is provided, the other router related delegates, routeInformationParser, routeInformationProvider, routerDelegate, and backButtonDispatcher, must all be null.
Implementation
WidgetsApp.router({
super.key,
this.routeInformationProvider,
this.routeInformationParser,
this.routerDelegate,
this.routerConfig,
this.backButtonDispatcher,
this.builder,
this.title = '',
this.onGenerateTitle,
this.textStyle,
required this.color,
this.locale,
this.localizationsDelegates,
this.localeListResolutionCallback,
this.localeResolutionCallback,
this.supportedLocales = const <Locale>[Locale('en', 'US')],
this.showPerformanceOverlay = false,
this.checkerboardRasterCacheImages = false,
this.checkerboardOffscreenLayers = false,
this.showSemanticsDebugger = false,
this.debugShowWidgetInspector = false,
this.debugShowCheckedModeBanner = true,
this.inspectorSelectButtonBuilder,
this.shortcuts,
this.actions,
this.restorationScopeId,
this.useInheritedMediaQuery = false,
}) : assert((){
if (routerConfig != null) {
assert(
(routeInformationProvider ?? routeInformationParser ?? routerDelegate ?? backButtonDispatcher) == null,
'If the routerConfig is provided, all the other router delegates must not be provided',
);
return true;
}
assert(routerDelegate != null, 'Either one of routerDelegate or routerConfig must be provided');
assert(
routeInformationProvider == null || routeInformationParser != null,
'If routeInformationProvider is provided, routeInformationParser must also be provided',
);
return true;
}()),
assert(title != null),
assert(color != null),
assert(supportedLocales != null && supportedLocales.isNotEmpty),
assert(showPerformanceOverlay != null),
assert(checkerboardRasterCacheImages != null),
assert(checkerboardOffscreenLayers != null),
assert(showSemanticsDebugger != null),
assert(debugShowCheckedModeBanner != null),
assert(debugShowWidgetInspector != null),
navigatorObservers = null,
navigatorKey = null,
onGenerateRoute = null,
pageRouteBuilder = null,
home = null,
onGenerateInitialRoutes = null,
onUnknownRoute = null,
routes = null,
initialRoute = null;