AppState<T extends StatefulWidget> constructor

AppState<T extends StatefulWidget>({
  1. Key? key,
  2. Widget? home,
  3. AppController? controller,
  4. List<StateXController>? controllers,
  5. Object? object,
  6. MaterialApp? materialApp,
  7. CupertinoApp? cupertinoApp,
  8. GlobalKey<NavigatorState>? navigatorKey,
  9. RouteInformationProvider? routeInformationProvider,
  10. RouteInformationParser<Object>? routeInformationParser,
  11. RouterDelegate<Object>? routerDelegate,
  12. RouterConfig<Object>? routerConfig,
  13. BackButtonDispatcher? backButtonDispatcher,
  14. GlobalKey<ScaffoldMessengerState>? scaffoldMessengerKey,
  15. Map<String, WidgetBuilder>? routes,
  16. String? initialRoute,
  17. RouteFactory? onGenerateRoute,
  18. RouteFactory? onUnknownRoute,
  19. List<NavigatorObserver>? navigatorObservers,
  20. TransitionBuilder? builder,
  21. String? title,
  22. GenerateAppTitle? onGenerateTitle,
  23. ThemeData? theme,
  24. CupertinoThemeData? iOSTheme,
  25. ThemeData? darkTheme,
  26. ThemeMode? themeMode,
  27. Color? color,
  28. Locale? locale,
  29. Iterable<LocalizationsDelegate>? localizationsDelegates,
  30. LocaleListResolutionCallback? localeListResolutionCallback,
  31. LocaleResolutionCallback? localeResolutionCallback,
  32. List<Locale>? supportedLocales,
  33. bool? useMaterial,
  34. bool? useCupertino,
  35. bool? switchUI,
  36. bool? debugShowMaterialGrid,
  37. bool? showPerformanceOverlay,
  38. bool? checkerboardRasterCacheImages,
  39. bool? checkerboardOffscreenLayers,
  40. bool? showSemanticsDebugger,
  41. bool? debugShowCheckedModeBanner,
  42. Map<LogicalKeySet, Intent>? shortcuts,
  43. Map<Type, Action<Intent>>? actions,
  44. String? restorationScopeId,
  45. ScrollBehavior? scrollBehavior,
  46. bool? useInheritedMediaQuery,
  47. bool? debugShowWidgetInspector,
  48. bool? debugPaintSizeEnabled,
  49. bool? debugPaintBaselinesEnabled,
  50. bool? debugPaintPointersEnabled,
  51. bool? debugPaintLayerBordersEnabled,
  52. bool? debugRepaintRainbowEnabled,
  53. bool? debugRepaintTextRainbowEnabled,
  54. FlutterExceptionHandler? errorHandler,
  55. ErrorWidgetBuilder? errorScreen,
  56. ReportErrorHandler? errorReport,
  57. FlutterExceptionHandler? inErrorHandler,
  58. ErrorWidgetBuilder? inErrorScreen,
  59. Future<void> inErrorReport(
    1. Object exception,
    2. StackTrace stack
    )?,
  60. void inInitState()?,
  61. Future<bool> inInitAsync()?,
  62. Widget inHome()?,
  63. RouteInformationProvider inRouteInformationProvider()?,
  64. RouteInformationParser<Object> inRouteInformationParser()?,
  65. RouterDelegate<Object> inRouterDelegate()?,
  66. RouterConfig<Object>? inRouterConfig()?,
  67. BackButtonDispatcher inBackButtonDispatcher()?,
  68. Map<String, WidgetBuilder> inRoutes()?,
  69. String inInitialRoute()?,
  70. RouteFactory inOnGenerateRoute()?,
  71. RouteFactory inOnUnknownRoute()?,
  72. List<NavigatorObserver> inNavigatorObservers()?,
  73. TransitionBuilder inTransBuilder()?,
  74. String inTitle()?,
  75. GenerateAppTitle? inGenerateTitle,
  76. ThemeData? inTheme()?,
  77. CupertinoThemeData? iniOSTheme()?,
  78. ThemeData? inDarkTheme()?,
  79. ThemeMode? inThemeMode()?,
  80. Color? inColor()?,
  81. Locale? inLocale()?,
  82. Iterable<LocalizationsDelegate> inLocalizationsDelegates()?,
  83. LocaleListResolutionCallback? inLocaleListResolutionCallback,
  84. LocaleResolutionCallback? inLocaleResolutionCallback,
  85. List<Locale>? inSupportedLocales()?,
  86. bool? inDebugShowMaterialGrid()?,
  87. bool? inShowPerformanceOverlay()?,
  88. bool? inCheckerboardRasterCacheImages()?,
  89. bool? inCheckerboardOffscreenLayers()?,
  90. bool? inShowSemanticsDebugger()?,
  91. bool? inDebugShowCheckedModeBanner()?,
  92. Map<LogicalKeySet, Intent>? inShortcuts()?,
  93. Map<Type, Action<Intent>>? inActions()?,
  94. String? inRestorationScopeId()?,
  95. ScrollBehavior? inScrollBehavior()?,
  96. bool? inInheritedMediaQuery()?,
  97. void inError(
    1. FlutterErrorDetails details
    )?,
  98. bool? inAsyncError(
    1. FlutterErrorDetails details
    )?,
})

Provide a huge array of options and features to the 'App State object.'

Implementation

AppState({
  this.key,
  this.home,
  AppController? controller,
  super.controllers,
  super.object,
  super.materialApp,
  super.cupertinoApp,
  super.navigatorKey,
  super.routeInformationProvider,
  super.routeInformationParser,
  super.routerDelegate,
  super.routerConfig,
  super.backButtonDispatcher,
  super.scaffoldMessengerKey,
  super.routes,
  super.initialRoute,
  super.onGenerateRoute,
  super.onUnknownRoute,
  super.navigatorObservers,
  super.builder,
  super.title,
  super.onGenerateTitle,
  super.theme,
  super.iOSTheme,
  super.darkTheme,
  super.themeMode,
  super.color,
  super.locale,
  super.localizationsDelegates,
  super.localeListResolutionCallback,
  super.localeResolutionCallback,
  super.supportedLocales,
  this.useMaterial,
  this.useCupertino,
  this.switchUI,
  super.debugShowMaterialGrid,
  super.showPerformanceOverlay,
  super.checkerboardRasterCacheImages,
  super.checkerboardOffscreenLayers,
  super.showSemanticsDebugger,
  super.debugShowCheckedModeBanner,
  super.shortcuts,
  super.actions,
  super.restorationScopeId,
  super.scrollBehavior,
  super.useInheritedMediaQuery,
  super.debugShowWidgetInspector,
  super.debugPaintSizeEnabled,
  super.debugPaintBaselinesEnabled,
  super.debugPaintPointersEnabled,
  super.debugPaintLayerBordersEnabled,
  super.debugRepaintRainbowEnabled,
  super.debugRepaintTextRainbowEnabled,
  super.errorHandler,
  super.errorScreen,
  super.errorReport,
  super.inErrorHandler,
  super.inErrorScreen,
  super.inErrorReport,
  this.inInitState,
  this.inInitAsync,
  this.inHome,
  this.inRouteInformationProvider,
  this.inRouteInformationParser,
  this.inRouterDelegate,
  this.inRouterConfig,
  this.inBackButtonDispatcher,
  this.inRoutes,
  this.inInitialRoute,
  this.inOnGenerateRoute,
  this.inOnUnknownRoute,
  this.inNavigatorObservers,
  this.inTransBuilder,
  this.inTitle,
  this.inGenerateTitle,
  this.inTheme,
  this.iniOSTheme,
  this.inDarkTheme,
  this.inThemeMode,
  this.inColor,
  this.inLocale,
  this.inLocalizationsDelegates,
  this.inLocaleListResolutionCallback,
  this.inLocaleResolutionCallback,
  this.inSupportedLocales,
  this.inDebugShowMaterialGrid,
  this.inShowPerformanceOverlay,
  this.inCheckerboardRasterCacheImages,
  this.inCheckerboardOffscreenLayers,
  this.inShowSemanticsDebugger,
  this.inDebugShowCheckedModeBanner,
  this.inShortcuts,
  this.inActions,
  this.inRestorationScopeId,
  this.inScrollBehavior,
  this.inInheritedMediaQuery,
  this.inError,
  this.inAsyncError,
})  : _stateRouteObserver = StateRouteObserver(),
      super(controller: controller ?? AppController()) {
  // In case null was explicitly passed in.
  useMaterial ??= false;
  useCupertino ??= false;
  switchUI ??= false;

  if (UniversalPlatform.isAndroid) {
    if (switchUI!) {
      useMaterial = false;
      useCupertino = true;
    } else if (useCupertino!) {
      useMaterial = false;
    } else {
      useMaterial = true;
      useCupertino = false;
    }
  } else if (UniversalPlatform.isIOS) {
    if (switchUI!) {
      useMaterial = true;
      useCupertino = false;
    } else if (useMaterial!) {
      useCupertino = false;
    } else {
      useMaterial = false;
      useCupertino = true;
    }
  } else {
    useMaterial = true;
    useCupertino = false;
  }

  // These ones can't be changed.
  _isMaterial = useMaterial;
  _isCupertino = useCupertino;
}