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

This commit is contained in:
David Adegoke
2025-09-26 10:16:00 +03:00
committed by GitHub
parent 8136b74022
commit fb830cc36b
+19
View File
@@ -9,6 +9,9 @@ Future<void> 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<void> 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'.");
}
}
}