toMaterialApp method

MaterialApp toMaterialApp({
  1. Key? key,
  2. GlobalKey<NavigatorState>? navigatorKey,
  3. GlobalKey<ScaffoldMessengerState>? scaffoldMessengerKey,
  4. Widget? home,
  5. String initialRoute = "/",
  6. bool onNavigationNotification(
    1. NavigationNotification navigationNotification
    )?,
  7. List<NavigatorObserver> navigatorObservers = const <NavigatorObserver>[],
  8. Widget builder(
    1. BuildContext context,
    2. Widget? widget
    )?,
  9. String title = '',
  10. String onGenerateTitle(
    1. BuildContext context
    )?,
  11. Color? color,
  12. ThemeData? theme,
  13. ThemeData? darkTheme,
  14. ThemeData? highContrastTheme,
  15. ThemeData? highContrastDarkTheme,
  16. ThemeMode? themeMode = ThemeMode.system,
  17. Duration themeAnimationDuration = kThemeAnimationDuration,
  18. Curve themeAnimationCurve = Curves.linear,
  19. Locale? locale,
  20. Iterable<LocalizationsDelegate>? localizationsDelegates,
  21. Locale? localeListResolutionCallback(
    1. List<Locale>? locales,
    2. Iterable<Locale> supportedLocales
    )?,
  22. Locale? localeResolutionCallback(
    1. Locale? locale,
    2. Iterable<Locale> supportedLocales
    )?,
  23. Iterable<Locale> supportedLocales = const <Locale>[Locale('en', 'US')],
  24. bool debugShowMaterialGrid = false,
  25. bool showPerformanceOverlay = false,
  26. bool checkerboardRasterCacheImages = false,
  27. bool checkerboardOffscreenLayers = false,
  28. bool showSemanticsDebugger = false,
  29. bool debugShowCheckedModeBanner = true,
  30. Map<ShortcutActivator, Intent>? shortcuts,
  31. Map<Type, Action<Intent>>? actions,
  32. String? restorationScopeId,
  33. ScrollBehavior? scrollBehavior,
  34. bool useInheritedMediaQuery = false,
  35. AnimationStyle? themeAnimationStyle,
})

Implementation

MaterialApp toMaterialApp({
  Key? key,
  GlobalKey<NavigatorState>? navigatorKey,
  GlobalKey<ScaffoldMessengerState>? scaffoldMessengerKey,
  Widget? home,
  String initialRoute = "/",
  bool Function(NavigationNotification navigationNotification)? onNavigationNotification,
  List<NavigatorObserver> navigatorObservers = const <NavigatorObserver>[],
  Widget Function(BuildContext context, Widget? widget)? builder,
  String title = '',
  String Function(BuildContext context)? 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<dynamic>>? localizationsDelegates,
  Locale? Function(List<Locale>? locales, Iterable<Locale> supportedLocales)? localeListResolutionCallback,
  Locale? Function(Locale? locale, Iterable<Locale> supportedLocales)? 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<Intent>>? actions,
  String? restorationScopeId,
  ScrollBehavior? scrollBehavior,
  bool useInheritedMediaQuery = false,
  AnimationStyle? themeAnimationStyle,
}) {
  return MaterialApp(
    routes: toRoutes(),
    initialRoute: initialRoute,
    onGenerateInitialRoutes: toOnGenerateInitialRoutes,
    onUnknownRoute: toOnUnknownRoute,
    onGenerateRoute: toOnGenerateRoute,

    key: key,
    navigatorKey: navigatorKey,
    scaffoldMessengerKey: scaffoldMessengerKey,
    actions: actions,
    // ignore: deprecated_member_use
    useInheritedMediaQuery: useInheritedMediaQuery,
    restorationScopeId: restorationScopeId,
    localeResolutionCallback: localeResolutionCallback,
    localeListResolutionCallback: localeListResolutionCallback,
    checkerboardRasterCacheImages: checkerboardRasterCacheImages,
    theme: theme,
    themeAnimationCurve: themeAnimationCurve,
    themeAnimationDuration: themeAnimationDuration,
    themeAnimationStyle: themeAnimationStyle,
    themeMode: themeMode,
    title: title,
    onGenerateTitle: onGenerateTitle,
    onNavigationNotification: onNavigationNotification,
    navigatorObservers: navigatorObservers,
    checkerboardOffscreenLayers: checkerboardOffscreenLayers,
    showPerformanceOverlay: showPerformanceOverlay,
    scrollBehavior: scrollBehavior,
    shortcuts: shortcuts,
    showSemanticsDebugger: showSemanticsDebugger,
    supportedLocales: supportedLocales,
    darkTheme: darkTheme,
    debugShowCheckedModeBanner: debugShowCheckedModeBanner,
    debugShowMaterialGrid: debugShowMaterialGrid,
    highContrastDarkTheme: highContrastDarkTheme,
    localizationsDelegates: localizationsDelegates,
    highContrastTheme: highContrastTheme,
    home: home,
    locale: locale,
    color: color,
    builder: builder,

  );
}