From bc9d8f80fccb544976f74d94a8e055254f6604f7 Mon Sep 17 00:00:00 2001 From: NBA2K1 <78034913+NBA2K1@users.noreply.github.com> Date: Mon, 6 Apr 2026 17:47:01 +0200 Subject: [PATCH 1/2] Fix Exception on startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ════════ Exception caught by Flutter framework ═════════════════════════════════ The following assertion was thrown during runApp: Zone mismatch. The Flutter bindings were initialized in a different zone than is now being used. This will likely cause confusion and bugs as any zone-specific configuration will inconsistently use the configuration of the original binding initialization zone or this zone based on hard-to-predict factors such as which zone was active when a particular callback was set. It is important to use the same zone when calling `ensureInitialized` on the binding as when calling `runApp` later. To make this warning fatal, set BindingBase.debugZoneErrorsAreFatal to true before the bindings are initialized (i.e. as the first statement in `void main() { }`). When the exception was thrown, this was the stack: #0 BindingBase.debugCheckZone. (package:flutter/src/foundation/binding.dart:519:31) binding.dart:519 #1 BindingBase.debugCheckZone (package:flutter/src/foundation/binding.dart:525:6) binding.dart:525 #2 _runWidget (package:flutter/src/widgets/binding.dart:1680:18) binding.dart:1680 #3 runApp (package:flutter/src/widgets/binding.dart:1616:3) binding.dart:1616 #4 main. (package:mangayomi/main.dart:108:7) main.dart:108 ════════════════════════════════════════════════════════════════════════════════ --- lib/main.dart | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index a4643c76..40c45922 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -56,30 +56,30 @@ DiscordRPC? discordRpc; WebViewEnvironment? webViewEnvironment; String? customDns; void main(List args) async { - WidgetsFlutterBinding.ensureInitialized(); - if (Platform.isLinux && runWebViewTitleBarWidget(args)) return; - - // Widget-layer errors (build / layout / paint) - FlutterError.onError = (FlutterErrorDetails details) { - FlutterError.presentError(details); // keep default red-screen in debug - AppLogger.log( - 'FlutterError: ${details.exceptionAsString()}\n${details.stack}', - logLevel: LogLevel.error, - ); - }; - - // Async errors that escape the Flutter framework (PlatformDispatcher) - PlatformDispatcher.instance.onError = (Object error, StackTrace stack) { - AppLogger.log( - 'PlatformDispatcher error: $error\n$stack', - logLevel: LogLevel.error, - ); - return true; // handled — prevent app termination - }; - // Zone-level catch-all for anything that slips through both layers runZonedGuarded( () async { + WidgetsFlutterBinding.ensureInitialized(); + if (Platform.isLinux && runWebViewTitleBarWidget(args)) return; + + // Widget-layer errors (build / layout / paint) + FlutterError.onError = (FlutterErrorDetails details) { + FlutterError.presentError(details); // keep default red-screen in debug + AppLogger.log( + 'FlutterError: ${details.exceptionAsString()}\n${details.stack}', + logLevel: LogLevel.error, + ); + }; + + // Async errors that escape the Flutter framework (PlatformDispatcher) + PlatformDispatcher.instance.onError = (Object error, StackTrace stack) { + AppLogger.log( + 'PlatformDispatcher error: $error\n$stack', + logLevel: LogLevel.error, + ); + return true; // handled — prevent app termination + }; + MediaKit.ensureInitialized(); await RustLib.init(); await imgCropIsolate.start(); From 8a39977c88b088d9b98514d9d3613eaa9cacd846 Mon Sep 17 00:00:00 2001 From: NBA2K1 <78034913+NBA2K1@users.noreply.github.com> Date: Mon, 6 Apr 2026 17:51:08 +0200 Subject: [PATCH 2/2] Workaround for libepoxy error when closing app on Linux. Caused by media-kit --- lib/main.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/main.dart b/lib/main.dart index 40c45922..fdb1f1e8 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -250,7 +250,11 @@ class _MyAppState extends ConsumerState void onWindowMoved() => WindowGeometry.save(); @override - void onWindowClose() => WindowGeometry.save(); + void onWindowClose() { + WindowGeometry.save(); + // Workaround for libepoxy error when closing app; caused by media-kit + if (Platform.isLinux) exit(0); + } Future _initDeepLinks() async { _appLinks = AppLinks();