Skip to content

Window on-close now broken in Flutter 3.9.2 #25

@driftwoodstudio

Description

@driftwoodstudio

Code that used to work fine now doesn't work after updating to Flutter 3.9.2, running in Windows.

  @override
  void initState() {
    WindowManagerPlus.current.addListener(this);
    // Add this line to override the default close handler
    Future(() =>  WindowManagerPlus.current.setPreventClose(true));
  }
  
  @override
  void onWindowClose([int? windowId]) async {
    count++;
    print('onWindowClose() : $count');
    ...
   }

The onWindowClose() function is called an infinite number of times on close event, running in Windows.

Connecting to VM Service at ws://127.0.0.1:57429/LyB87Q0gVDc=/ws
Connected to the VM Service.
onWindowClose() : 1
onWindowClose() : 2
onWindowClose() : 3
onWindowClose() : 4
onWindowClose() : 5
onWindowClose() : 6
onWindowClose() : 7
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions