hienlee
hienlee

Reputation: 33

How to require user to set phone password in app by Flutter?

I'm working on an app in Flutter that needs to require users to set a PIN/Password/FaceID/... on their phone (any authenticate method) if there is currently none, for security purposes for the app. I'm currently looking for a Flutter library or a method that can help me with this, but still can't find it.

My expectation is simple, when the user opens the app, it will check if the current device has any local authenticate method in use. If none, the app will show a dialog to inform the user and take him to the settings.

I appreciate all your answers! Pls help!

Upvotes: 3

Views: 751

Answers (1)

conthanhng
conthanhng

Reputation: 74

You can use the local_auth to check the device is set any type of security or NOT with this function:

final List<BiometricType> availableBiometrics = await auth.getAvailableBiometrics();

If the result is empty, it mean you have not set any type of security in the device.

Upvotes: 3

Related Questions