MaterialApp.router constructor Null safety
- {Key? key,
- GlobalKey<
ScaffoldMessengerState> ? scaffoldMessengerKey, - RouteInformationProvider? routeInformationProvider,
- RouteInformationParser<
Object> ? routeInformationParser, - RouterDelegate<
Object> ? routerDelegate, - RouterConfig<
Object> ? routerConfig, - BackButtonDispatcher? backButtonDispatcher,
- TransitionBuilder? builder,
- String title = '',
- GenerateAppTitle? onGenerateTitle,
- Color? color,
- ThemeData? theme,
- ThemeData? darkTheme,
- ThemeData? highContrastTheme,
- ThemeData? highContrastDarkTheme,
- ThemeMode? themeMode = ThemeMode.system,
- Duration themeAnimationDuration = kThemeAnimationDuration,
- Curve themeAnimationCurve = Curves.linear,
- Locale? locale,
- Iterable<
LocalizationsDelegate> ? localizationsDelegates, - LocaleListResolutionCallback? localeListResolutionCallback,
- LocaleResolutionCallback? localeResolutionCallback,
- Iterable<
Locale> supportedLocales = const <Locale>[Locale('en', 'US')], - bool debugShowMaterialGrid = false,
- bool showPerformanceOverlay = false,
- bool checkerboardRasterCacheImages = false,
- bool checkerboardOffscreenLayers = false,
- bool showSemanticsDebugger = false,
- bool debugShowCheckedModeBanner = true,
- Map<
ShortcutActivator, Intent> ? shortcuts, - Map<
Type, Action< ? actions,Intent> > - String? restorationScopeId,
- ScrollBehavior? scrollBehavior,
- bool useInheritedMediaQuery = false}
Creates a MaterialApp 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
const MaterialApp.router({
super.key,
this.scaffoldMessengerKey,
this.routeInformationProvider,
this.routeInformationParser,
this.routerDelegate,
this.routerConfig,
this.backButtonDispatcher,
this.builder,
this.title = '',
this.onGenerateTitle,
this.color,
this.theme,
this.darkTheme,
this.highContrastTheme,
this.highContrastDarkTheme,
this.themeMode = ThemeMode.system,
this.themeAnimationDuration = kThemeAnimationDuration,
this.themeAnimationCurve = Curves.linear,
this.locale,
this.localizationsDelegates,
this.localeListResolutionCallback,
this.localeResolutionCallback,
this.supportedLocales = const <Locale>[Locale('en', 'US')],
this.debugShowMaterialGrid = false,
this.showPerformanceOverlay = false,
this.checkerboardRasterCacheImages = false,
this.checkerboardOffscreenLayers = false,
this.showSemanticsDebugger = false,
this.debugShowCheckedModeBanner = true,
this.shortcuts,
this.actions,
this.restorationScopeId,
this.scrollBehavior,
this.useInheritedMediaQuery = false,
}) : assert(routerDelegate != null || routerConfig != null),
assert(title != null),
assert(debugShowMaterialGrid != null),
assert(showPerformanceOverlay != null),
assert(checkerboardRasterCacheImages != null),
assert(checkerboardOffscreenLayers != null),
assert(showSemanticsDebugger != null),
assert(debugShowCheckedModeBanner != null),
navigatorObservers = null,
navigatorKey = null,
onGenerateRoute = null,
home = null,
onGenerateInitialRoutes = null,
onUnknownRoute = null,
routes = null,
initialRoute = null;