MaterialApp constructor
- Key? key,
- GlobalKey<ScaffoldMessengerState> ? scaffoldMessengerKey,
- Widget? home,
- Map<String, WidgetBuilder> routes = const <String, WidgetBuilder>{},
- String? initialRoute,
- RouteFactory? onGenerateRoute,
- InitialRouteListFactory? onGenerateInitialRoutes,
- RouteFactory? onUnknownRoute,
- 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,
- @Deprecated('Remove this parameter as it is now ignored. ' 'MaterialApp never introduces its own MediaQuery; the View widget takes care of that. ' 'This feature was deprecated after v3.7.0-29.0.pre.') bool useInheritedMediaQuery = false,
- AnimationStyle? themeAnimationStyle,
Creates a MaterialApp.
At least one of home, routes, onGenerateRoute, or builder must be
non-null. If only routes is given, it must include an entry for the
Navigator.defaultRouteName (/), since that is the route used when the
application is launched with an intent that specifies an otherwise
unsupported route.
This class creates an instance of WidgetsApp.
Implementation
const MaterialApp({
  super.key,
  this.navigatorKey,
  this.scaffoldMessengerKey,
  this.home,
  Map<String, WidgetBuilder> this.routes = const <String, WidgetBuilder>{},
  this.initialRoute,
  this.onGenerateRoute,
  this.onGenerateInitialRoutes,
  this.onUnknownRoute,
  this.onNavigationNotification,
  List<NavigatorObserver> this.navigatorObservers = const <NavigatorObserver>[],
  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,
  @Deprecated(
    'Remove this parameter as it is now ignored. '
    'MaterialApp never introduces its own MediaQuery; the View widget takes care of that. '
    'This feature was deprecated after v3.7.0-29.0.pre.',
  )
  this.useInheritedMediaQuery = false,
  this.themeAnimationStyle,
}) : routeInformationProvider = null,
     routeInformationParser = null,
     routerDelegate = null,
     backButtonDispatcher = null,
     routerConfig = null;