Hy, I want to develop an app in which users are first restricted for fingerprint authentication and after fingerprint authentication, users will be restricted to face id authentication. But when I use Local_auth.authenticate it gives the option to the user either want to scan fingerprint or face id how can I fix this.
Asked
Active
Viewed 163 times
-1
-
iOS devices have either fingerprint or face identification. Not both – Paulw11 Sep 23 '21 at 07:33
-
Yes, If the device doesn't support any type of biometric then the app will not ask for that. – Saad Mehmood Sep 23 '21 at 07:42
-
You should probably remove the iOS tag since the question doesn't make sense for iOS – Paulw11 Sep 23 '21 at 07:44
-
Please provide enough code so others can better understand or reproduce the problem. – Community Sep 30 '21 at 12:29
1 Answers
0
You can try below the code:
Future<void> _authenticateMe() async {
// 8. this method opens a dialog for fingerprint authentication.
// we do not need to create a dialog nut it popsup from device natively.
bool authenticated = false;
try {
authenticated = await _localAuthentication.authenticateWithBiometrics(
localizedReason: "Authenticate for Testing", // message for dialog
useErrorDialogs: true,// show error in dialog
stickyAuth: true,// native process
);
print('support device try: '+authenticated.toString());
} catch (e) {
print('support device catch: '+e.toString());
print(e);
}
if (!mounted) return;
setState(() {
_authorizedOrNot = authenticated ? "Authorized" : "Not Authorized";
});
if(_authorizedOrNot == 'Authorized'){
Navigator.of(context).push(MaterialPageRoute(builder: (context) => HomeScreen()));
}
}

Mostafijur Rahman
- 191
- 2
- 7
-
I have tried the given code but on authentication, It gives the option to the user either want to authenticate with fingerprint or face Id. – Saad Mehmood Sep 23 '21 at 07:23
-