desktop_lifecycle
0.1.2, released 3 months ago by mixin.dev
Allows Flutter desktop applications to perceive window activation state.
What it does
Allows your Flutter desktop application to perceive whether the window is activated. Provides a ValueListenable to check and listen to window active/inactive events.
AI-written summary of version 0.1.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to know when your Flutter desktop app window is focused or activated.
- You want to pause or resume tasks based on desktop window focus.
Skip it when
- You are building strictly for mobile or web platforms.
- You need complex window management features beyond checking activation.
Strengths
- Simple API using ValueListenable.
- Supports multiple desktop platforms (Windows, macOS, Linux).
Weaknesses
- Limited to window activation state perception.
- No documentation on advanced window management features.
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
Add desktop_lifecycle to your pubspec.yaml and use DesktopLifecycle.instance.isActive.
final ValueListenable<bool> event = DesktopLifecycle.instance.isActive;
final bool active = event.value;
event.addListener(() {
debugPrint("window activate: ${event.value}");
});Alternatives
Packages that do the same job and could replace desktop_lifecycle.
- zikzak_inappwebview
A Flutter plugin providing inline WebView, headless WebView, and in-app browser features.
80Compare - xdg_desktop_portal
A native Dart implementation of portals for Linux desktop applications.
75Compare - window_size
Allows resizing, repositioning, and querying screen information for desktop Flutter windows.
60Compare - flutter_inappwebview
Add inline WebViews, headless WebViews, and in-app browser windows.
50Compare
Works with
Packages commonly used together with desktop_lifecycle: ones it builds on, ones built on it, and its own family.