Skip to content
pubscout

proximity_screen_lock

2.3.0, released 6 months ago by mantoux.org

Bind screen activation to proximity sensor and detect proximity events in Flutter.

WASM-ready
$ flutter pub add proximity_screen_lock
Source repository

What it does

A Flutter plugin that binds screen activation to the device proximity sensor. It allows detecting proximity events and checking if proximity locking is supported or available on the current device.

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

Use it when

  • You want to turn off or lock the screen when an object is close to the proximity sensor
  • You need to listen to proximity sensor state changes on mobile devices

Skip it when

  • You are building for non-mobile platforms where proximity sensors are absent
  • You need general sensor access beyond proximity

Strengths

  • Simple API to toggle active proximity locking
  • Provides stream of proximity states
  • Checks sensor availability for iOS and Android

Weaknesses

  • Not supported on non-mobile platforms
  • Availability depends on hardware support on Android

Setup

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

not documented

if (ProximityLockScreen.isProximityLockSupported()) {
  ProximityLockScreen.setActive(true);
  ProximityScreenLock.proximityStates.listen((objectDetected) async {
    print(objectDetected ? 'Object detected' : 'No object detected');
  });
}

Alternatives

Packages that do the same job and could replace proximity_screen_lock.