我正在使用https://pub.dev/packages/local_auth库local_auth在我的应用程序中实现。
我正在使用以下代码进行身份验证。
Future<void> _authenticate() async {
bool authenticated = false;
try {
authenticated = await auth.authenticateWithBiometrics(
localizedReason: 'Scan your fingerprint to authenticate');
print('Authentitcated: $authenticated');
} on PlatformException catch (e) {
print(e);
}
}
如果是身份验证,success则显示Authenticated: true,但如果身份验证失败,则不显示任何内容。此外,如果身份验证失败,身份验证对话会自动关闭。
false即使身份验证失败,如何返回身份验证状态也保持对话打开?