Skip to content
pubscout

is_lock_screen

2.0.0, released 6 years ago by tarosago.xyz

Detects if a device is currently in the lock screen.

WASM-ready
$ flutter pub add is_lock_screen
Source repository

What it does

Provides a method to check whether the mobile device is currently locked. It helps distinguish whether an app entered the background because the user locked the screen or because they navigated away from the app.

AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to know if the app went to the background due to a device lock.
  • You want to handle app lifecycle security logic depending on lock status.

Skip it when

  • You are running tests or running iOS on a simulator (iOS detection only works on physical devices).
  • You need complex hardware button event streaming.

Strengths

  • Simple, single-purpose API.
  • Avoids using non-public APIs on iOS to comply with App Store requirements.

Weaknesses

  • iOS detection relies on screen brightness checking and only works on physical devices.
  • No stream-based listening out of the box, requires manual polling via lifecycle observers.

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
0

Not documented

bool? result = await isLockScreen();

Alternatives

Packages that do the same job and could replace is_lock_screen.