From fb830cc36bb5e2f844a14a4f5f118896934b1d17 Mon Sep 17 00:00:00 2001 From: David Adegoke <64401859+Blazebrain@users.noreply.github.com> Date: Fri, 26 Sep 2025 08:16:00 +0100 Subject: [PATCH] fix: Tentative fix for windowsize missing plugin exception (#2544) --- cw_core/lib/window_size.dart | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/cw_core/lib/window_size.dart b/cw_core/lib/window_size.dart index dffbfab99..4a084897d 100644 --- a/cw_core/lib/window_size.dart +++ b/cw_core/lib/window_size.dart @@ -9,6 +9,9 @@ Future setDefaultMinimumWindowSize() async { if (!Platform.isMacOS) return; try { + // A small delay to confirm that our native platform channels are ready + await Future.delayed(const Duration(milliseconds: 100)); + final result = await _channel.invokeMethod( 'setMinWindowSize', {'width': 500, 'height': 700}, @@ -19,5 +22,21 @@ Future setDefaultMinimumWindowSize() async { } } on PlatformException catch (e) { printV("Failed to set minimum window size: '${e.message}'."); + } on MissingPluginException catch (e) { + printV("Native utils plugin not available yet: '${e.message}'. Retrying..."); + // We give it a longer delay this time around, and then retry + await Future.delayed(const Duration(milliseconds: 500)); + try { + final result = await _channel.invokeMethod( + 'setMinWindowSize', + {'width': 500, 'height': 700}, + ) as bool; + + if (!result) { + printV("Failed to set minimum window size on retry."); + } + } catch (retryError) { + printV("Failed to set minimum window size after retry: '$retryError'."); + } } }