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

Time:12-07

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!

CodePudding user response:

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

final List availableBiometrics = await auth.getAvailableBiometrics();

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

CodePudding user response:

One way to require a user to set a phone password in an app built with Flutter is to use the local_auth package. This package provides an easy-to-use API that allows you to authenticate the user with their device's security features such as fingerprint, face ID, or passcode. You can use it to prompt the user to set a new password or confirm their existing password before proceeding with an action in your app.

  • Related