Temporarily comment run app on error of run zone guard

This commit is contained in:
OmarHatem 2022-11-27 14:44:35 +02:00
parent 7b99e409a9
commit 51ea377a52

View file

@ -161,34 +161,38 @@ Future<void> main() async {
initialMigrationVersion: 17); initialMigrationVersion: 17);
runApp(App()); runApp(App());
}, (error, stackTrace) async { }, (error, stackTrace) async {
print("@@@@@@@@@@@@@@@@");
print(error);
print(stackTrace);
_saveException(error.toString(), stackTrace); _saveException(error.toString(), stackTrace);
final sharedPreferences = await SharedPreferences.getInstance(); // TODO: this will trigger even there is no fatal error occurred so better not build a new app instance
final theme = ThemeList.deserialize( // final sharedPreferences = await SharedPreferences.getInstance();
raw: sharedPreferences.getInt(PreferencesKey.currentTheme) ?? 0); // final theme = ThemeList.deserialize(
// raw: sharedPreferences.getInt(PreferencesKey.currentTheme) ?? 0);
final savedLanguageCode = //
sharedPreferences.getString(PreferencesKey.currentLanguageCode) ?? // final savedLanguageCode =
await LanguageService.localeDetection(); // sharedPreferences.getString(PreferencesKey.currentLanguageCode) ??
runApp( // await LanguageService.localeDetection();
MaterialApp( // runApp(
debugShowCheckedModeBanner: true, // MaterialApp(
theme: theme.themeData, // debugShowCheckedModeBanner: true,
localizationsDelegates: [ // theme: theme.themeData,
S.delegate, // localizationsDelegates: [
GlobalCupertinoLocalizations.delegate, // S.delegate,
GlobalMaterialLocalizations.delegate, // GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate, // GlobalMaterialLocalizations.delegate,
], // GlobalWidgetsLocalizations.delegate,
supportedLocales: S.delegate.supportedLocales, // ],
locale: Locale(savedLanguageCode), // supportedLocales: S.delegate.supportedLocales,
home: Scaffold( // locale: Locale(savedLanguageCode),
body: FailurePage( // home: Scaffold(
error: error.toString(), // body: FailurePage(
stackTrace: stackTrace, // error: error.toString(),
), // stackTrace: stackTrace,
), // ),
), // ),
); // ),
// );
}); });
} }