desktop_window icon indicating copy to clipboard operation
desktop_window copied to clipboard

Unhandled Exception: mainWindow not found

Open LiveRock opened this issue 2 years ago • 4 comments

Can't set app to full screen using the following command:

await DesktopWindow.setFullScreen(true);

Error:

[ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: mainWindow not found
#0      DesktopWindow.getWindowSize (package:desktop_window/desktop_window.dart:16:5)
<asynchronous suspension> 

Environment: MacOS 11.4 Big Sur Mac Mini M1

Flutter doctor Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-arm, locale en-GB) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [✓] Xcode - develop for iOS and macOS [✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. [✓] Android Studio (version 4.2) [✓] VS Code (version 1.55.2) [✓] Connected device (1 available)

What could I have done wrong?

LiveRock avatar Jul 22 '21 08:07 LiveRock

I have the same problem。

flutter: getWindowSize err: PlatformException(MAINWINDOW_NOT_FOUND, GtkWindow not found, null, null), #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7) #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:18) <asynchronous suspension> #2 DesktopWindow.getWindowSize (package:desktop_window/desktop_window.dart:12:17) <asynchronous suspension> #3 FutureExtensions.onError.<anonymous closure> (dart:async/future.dart) <asynchronous suspension> Environment: OS: Manjaro Linux x86_64 Kernel: 5.10.56-1-MANJARO

colatea avatar Aug 16 '21 06:08 colatea

I got the same problem with the function setMinWindowSize. It was working before, but today it was not working a few times but not logging any error to the console. So I made a print of the result of the function and it says "mainWindow not found".

I'm using MacOS and I call the function before the runApp. The problem seems to happen when the program opens while I am full-screen using the IDE or other screen that is not the desktop where the app opens.

hyungtaecf avatar Mar 26 '22 22:03 hyungtaecf

I have the same occurrence pattern as @hyungtaecf Everything runs fine as long as I keep my computer's focus on where the desktop simulator open.

Using MacOS, Flutter 2.13, beta channel

PhysicalRevelry avatar Apr 22 '22 19:04 PhysicalRevelry