From 0ebca108fef568188f05c64e713f045aec46f913 Mon Sep 17 00:00:00 2001 From: Christien Rioux Date: Sat, 14 Oct 2023 14:07:58 -0400 Subject: [PATCH] fix error zone --- lib/main.dart | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index f73c6ba..3644eab 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -27,28 +27,29 @@ void main() async { // Ansi colors ansiColorDisabled = false; - // Logs - initLoggy(); + // Catch errors + await runZonedGuarded(() async { + // Logs + initLoggy(); - // Prepare theme - WidgetsFlutterBinding.ensureInitialized(); - final themeService = await ThemeService.instance; - final initTheme = themeService.initial; + // Prepare theme + WidgetsFlutterBinding.ensureInitialized(); + final themeService = await ThemeService.instance; + final initTheme = themeService.initial; - // Manage window on desktop platforms - await WindowControl.initialize(); + // Manage window on desktop platforms + await WindowControl.initialize(); - // Make localization delegate - final delegate = await LocalizationDelegate.create( - fallbackLocale: 'en_US', supportedLocales: ['en_US']); - await initializeDateFormatting(); + // Make localization delegate + final delegate = await LocalizationDelegate.create( + fallbackLocale: 'en_US', supportedLocales: ['en_US']); + await initializeDateFormatting(); - // Start up Veilid and Veilid processor in the background - unawaited(initializeVeilid()); + // Start up Veilid and Veilid processor in the background + unawaited(initializeVeilid()); - // Run the app - // Hot reloads will only restart this part, not Veilid - runZonedGuarded(() { + // Run the app + // Hot reloads will only restart this part, not Veilid runApp(ProviderScope( observers: const [StateLogger()], child: LocalizedApp(delegate, VeilidChatApp(theme: initTheme))));