'How to track the time when the phone lock is open of closed?

How to track how many times does user unlock his/her phone in flutter?



Solution 1:[1]

That is something very platform specific. Because this is a rather unusual Usecase I doubt that there is any package that offers this functionality. Therefore you will probably have to use MethodChannels and implement it with platform specific code for each platform you want to support. Here is an explanation on how to do it for android: Android - detect phone unlock event, not screen on

Solution 2:[2]

You can use this library for this situation: https://pub.dev/packages/is_lock_screen

With this library you can counter how many times locked and unlocked phone in flutter

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 TheUltimateOptimist
Solution 2 MalikSenpai