is_lock_screen
2.0.0, released 6 years ago by tarosago.xyz
Detects if a device is currently in the lock screen.
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.
- is_lock_screen2
Detects whether an Android or iOS device is currently in the lock screen state.
56Compare - wakelock_plus
Keep the device screen awake across mobile, desktop, and web platforms.
92Compare - flutter_overlay_window
Flutter plugin to display your app over other apps on the screen.
85Compare - corner_radius_plugin
Flutter plugin to read device screen corner radii on Android and iOS
69Compare