You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add window/application lifecycle delegation for desktop shells #30735
Example use case: A document-based Flutter application should be able to prevent a window from being closed (e.g., with an alert) if the document corresponding to that window is unsaved.
At the very least plugins need to be able to register for application and window lifecycle events (as they can for application lifecycle on iOS), but we may want to consider making system channels for the most common cases.
The specific case that this was originally filed for was delegation, not just observation, so at least some new mechanism would be needed. Supporting the existing lifecycle structure might be part of it though.
Capturing from a Discord discussion about autoupdate on Windows:
Squirrel supports customizing installation and post-update by running your app with a special command-line flag --squirrel-install, --squirrel-updated, etc etc - your Flutter app needs to do what it wants for that customization (set up shortcuts, file associations, whatever), then immediately exit without opening a Window
Autoupdate is something that we want to facilitate building plugins for, so we should make sure there's a lifecycle hook that's before the window is displayed.
Implementation of AppLifecycleState would be great. My use-case: auto-close/lock of open files when the app is in the background/idle for some time. Would be the easiest way to detect when the user hasn't interacted with the app for some time. (ie. inactive vs resumed)
Implementation of AppLifecycleState would be great. My use-case: auto-close/lock of open files when the app is in the background/idle for some time. Would be the easiest way to detect when the user hasn't interacted with the app for some time. (ie. inactive vs resumed)
"Idle" isn't a clear, OS-defined application state, and would not be part of this. If you want to do something based on the user not interacting with the app for a while, that is something you would need to implement yourself based on what "idle" means to your use case.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
dschuyler commentedon Oct 1, 2019
Would this use the
AppLifecycleStateandState<LifecycleWatcher>or would it be some other mechanism (just asking to understand better)?stuartmorgan-g commentedon Oct 1, 2019
The specific case that this was originally filed for was delegation, not just observation, so at least some new mechanism would be needed. Supporting the existing lifecycle structure might be part of it though.
stuartmorgan-g commentedon Jan 23, 2020
Capturing from a Discord discussion about autoupdate on Windows:
Autoupdate is something that we want to facilitate building plugins for, so we should make sure there's a lifecycle hook that's before the window is displayed.
hpoul commentedon Aug 12, 2020
Implementation of
AppLifecycleStatewould be great. My use-case: auto-close/lock of open files when the app is in the background/idle for some time. Would be the easiest way to detect when the user hasn't interacted with the app for some time. (ie.inactivevsresumed)stuartmorgan-g commentedon Aug 12, 2020
"Idle" isn't a clear, OS-defined application state, and would not be part of this. If you want to do something based on the user not interacting with the app for a while, that is something you would need to implement yourself based on what "idle" means to your use case.
16 remaining items
[macOS] Remove FlutterApplication class (#40939)
[macOS] Remigrate principal class to NSApplication (flutter#124173)
Adding app lifecycle notification for macOS and Linux, add `hidden` s…
Add `AppLifecycleListener`, with support for application exit handling (
gspencergoog commentedon Oct 19, 2023
This has been completed. See AppLifecycleListener and the related classes.
github-actions commentedon Nov 2, 2023
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.