fix: Tentative fix for windowsize missing plugin exception (#2544)

David Adegoke committed Sep 26, 2025 at 08:16 UTC fb830cc36bb5e2f844a14a4f5f118896934b1d17
1 file changed +19
cw_core/lib/window_size.dart
+19
@@ -9,6 +9,9 @@ Future<void> setDefaultMinimumWindowSize() async {
9 if (!Platform.isMacOS) return;
10
11 try {
12 + // A small delay to confirm that our native platform channels are ready
13 + await Future.delayed(const Duration(milliseconds: 100));
14 +
15 final result = await _channel.invokeMethod(
16 'setMinWindowSize',
17 {'width': 500, 'height': 700},
@@ -19,5 +22,21 @@ Future<void> setDefaultMinimumWindowSize() async {
22 }
23 } on PlatformException catch (e) {
24 printV("Failed to set minimum window size: '${e.message}'.");
25 + } on MissingPluginException catch (e) {
26 + printV("Native utils plugin not available yet: '${e.message}'. Retrying...");
27 + // We give it a longer delay this time around, and then retry
28 + await Future.delayed(const Duration(milliseconds: 500));
29 + try {
30 + final result = await _channel.invokeMethod(
31 + 'setMinWindowSize',
32 + {'width': 500, 'height': 700},
33 + ) as bool;
34 +
35 + if (!result) {
36 + printV("Failed to set minimum window size on retry.");
37 + }
38 + } catch (retryError) {
39 + printV("Failed to set minimum window size after retry: '$retryError'.");
40 + }
41 }
42 }