You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter中FirebaseAuthException错误码始终返回'unknown'问题求助

Flutter中FirebaseAuthException错误码始终返回'unknown'问题求助

大家好,我最近在学习Flutter,遇到了一个搞不懂的问题,想请教一下各位!

我写了一段Firebase邮箱密码登录的代码,如下:

try {
  final userCredentials = await FirebaseAuth.instance
      .signInWithEmailAndPassword(
          email: email, password: password);
  print(userCredentials);
} on FirebaseAuthException catch (err) {
  if (err.code == 'user-not-found') {
    print("User not found");
  } else if (err.code == 'wrong-password') {
    print("Wrong password");
  }
}

但不知道什么原因,捕获到的FirebaseAuthException的err.code始终只返回'unknown',有没有朋友遇到过同样的问题呢?

我已经尝试过更换错误变量名,也查阅了FirebaseAuth的官方文档确认错误码,但还是没能解决这个问题。

提前感谢大家的回复!

备注:内容来源于stack exchange,提问作者Tranathos

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.22 13:29:38