Skip to content
pubscout

desktop_lifecycle

0.1.2, released 3 months ago by mixin.dev

Allows Flutter desktop applications to perceive window activation state.

WASM-ready
$ flutter pub add desktop_lifecycle
Source repository

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.

Works with

Packages commonly used together with desktop_lifecycle: ones it builds on, ones built on it, and its own family.