Flutter 如果身份验证失败,则“颤振本地验证”对话框关闭

Flutter 如果身份验证失败,则“颤振本地验证”对话框关闭,flutter,dart,Flutter,Dart,我正在使用库在我的应用程序中实现local\u auth 我正在使用以下代码进行身份验证 Future<void> _authenticate() async { bool authenticated = false; try { authenticated = await auth.authenticateWithBiometrics( localizedReason: 'Scan your fingerprint to auth

我正在使用库在我的应用程序中实现
local\u 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);
    }
  }
Future\u authenticate()异步{
bool=false;
试一试{
已验证=等待验证。使用生物特征进行验证(
localizedReason:“扫描指纹以进行身份验证”);
打印('authenticated:$authenticated');
}平台上异常捕获(e){
印刷品(e);
}
}
如果身份验证是
success
,则显示
Authenticated:true
,但如果身份验证失败,则不显示任何内容。此外,如果身份验证失败,身份验证对话框将自动关闭


如何返回身份验证
false
状态?即使身份验证失败,也要保持对话框打开?

此方法不会返回任何内容。@Styx Yes。我知道。但即使我没有返回任何东西,打印也应该有效。事实上,没有。如果:1)验证完整;2) 您捕获到
PlatformException
错误。如果有其他类型的错误怎么办?没有其他
异常。程序在
authenticated=wait auth.authenticateWithBiometrics(localizedReason:“扫描指纹进行身份验证”)您没有从该方法返回任何内容。@Styx是。我知道。但即使我没有返回任何东西,打印也应该有效。事实上,没有。如果:1)验证完整;2) 您捕获到
PlatformException
错误。如果有其他类型的错误怎么办?没有其他
异常。程序在
authenticated=wait auth.authenticateWithBiometrics(localizedReason:“扫描指纹进行身份验证”)