unlock_detector 0.0.1
unlock_detector: ^0.0.1 copied to clipboard
A Flutter Package to detect if app running while phone is locked or not.
Unlock Detector Plugin for Flutter #
This Flutter plugin allows you to detect screen lock and unlock events on both Android and iOS devices.
Features #
- Detect when the screen is locked or unlocked.
Installation #
Add this to your package's pubspec.yaml
file:
dependencies:
unlock_detector:
Usage #
final UnlockDetector _unlockDetector = UnlockDetector();
String _status = 'Unknown';
_unlockDetector.startDetection();
_unlockDetector.lockUnlockStream?.listen((event) {
setState(() {
_status = event;
});
});
...
body: Center(
child: Text('Lock/Unlock Status: $_status'),
),
...
Support #
If you find this plugin helpful, consider supporting me: