What is the best practise for presenting a pin on app wake from sleep?

We currently have a business back-end app with a requirement to default to a pin page to keep data secure when the app wakes from sleep. This is because the devices used are shared between staff members, and they sometimes forget to remember to log out at the end of a shift.

I've implemented this by operating a timeout function that resets upon interactions. If there is no interactivity after some time, the device will present a PIN screen the next time a user tries to interact with the app.

The problem is - there are better solutions than this. There are security issues and a lot of code duplication.

If I were hand-coding the app, I would present a PIN view on waking from sleep. Although I don't see an easy way to do this with FF.

Does anyone have a similar issue or have any ideas on what might be possible? Ideally, I don't want to use custom code relying on pub.dev packages on this if possible - as it tends to break on FF upgrades.

3