KareeMaterialApp constructor

KareeMaterialApp({
  1. Key? key,
  2. required ApplicationKind kind,
  3. String? restorationScopeId,
  4. GlobalKey<ScaffoldMessengerState>? scaffoldMessengerKey,
  5. List<NavigatorObserver> navigatorObservers = const <NavigatorObserver>[],
  6. String title = '',
  7. GenerateAppTitle? onGenerateTitle,
  8. Color? color,
  9. CupertinoThemeData? cupertinoTheme,
  10. ThemeData? theme,
  11. ThemeData? darkTheme,
  12. ThemeMode themeMode = ThemeMode.system,
  13. Locale? locale,
  14. LocaleListResolutionCallback? localeListResolutionCallback,
  15. LocaleResolutionCallback? localeResolutionCallback,
  16. Iterable<Locale> supportedLocales = const <Locale>[],
  17. bool debugShowMaterialGrid = false,
  18. bool showPerformanceOverlay = false,
  19. bool checkerboardRasterCacheImages = false,
  20. bool checkerboardOffscreenLayers = false,
  21. bool showSemanticsDebugger = false,
  22. bool debugShowCheckedModeBanner = true,
  23. Map<LogicalKeySet, Intent>? shortcuts,
  24. KareeInstanceProfile profile = KareeInstanceProfile.development,
  25. Map<Type, Action<Intent>>? actions,
  26. ThemeData? highContrastDarkTheme,
  27. ThemeData? highContrastTheme,
  28. required List<Of> observables,
  29. ErrorContactAddress? errorContactAddress,
})

Implementation

KareeMaterialApp(
    {Key? key,
    required this.kind,
    this.restorationScopeId,
    this.scaffoldMessengerKey,
    this.navigatorObservers = const <NavigatorObserver>[],
    this.title = '',
    this.onGenerateTitle,
    this.color,
    this.cupertinoTheme,
    this.theme,
    this.darkTheme,
    this.themeMode = ThemeMode.system,
    this.locale,
    this.localeListResolutionCallback,
    this.localeResolutionCallback,
    this.supportedLocales = const <Locale>[],
    this.debugShowMaterialGrid = false,
    this.showPerformanceOverlay = false,
    this.checkerboardRasterCacheImages = false,
    this.checkerboardOffscreenLayers = false,
    this.showSemanticsDebugger = false,
    this.debugShowCheckedModeBanner = true,
    this.shortcuts,
    this.profile = KareeInstanceProfile.development,
    this.actions,
    this.highContrastDarkTheme,
    this.highContrastTheme,
    required this.observables,
    this.errorContactAddress}) {
  assert(profile == KareeInstanceProfile.development ||
      (profile == KareeInstanceProfile.production &&
          errorContactAddress != null));
  KareeMaterialApp.globalProfile = profile;
  KareeMaterialApp.globalErrorContactAddress = errorContactAddress;
  KareeInternationalization.init(locale, supportedLocales.toList())
      .catchError((onError, st) {
    var ex = onError as TranslationFileNotExists;

    KareeRouter.goto(KareeConstants.kareeErrorPath, parameter: {
      #title: ex.message,
      #stack: st,
      #env: [
        '${ex.locale.languageCode}${ex.locale.countryCode == null ? '' : '_${ex.locale.countryCode!.toLowerCase()}'}.json',
      ],
      #errorCode: KareeErrorCode.noTranslationFile
    });
  }, test: (exception) => exception is TranslationFileNotExists);

  // uncomment for testing
  // if (!Platform.environment.containsKey('FLUTTER_TEST')) {
  ErrorWidget.builder = (FlutterErrorDetails detail) {
    return KareeRouterErrorWidget(
        detail.summary.name,
        detail.stack,
        KareeErrorCode.generalError,
        detail.context!.getChildren().map((e) => e.name ?? '').toList());
  };
  // }
}