我尝试在用户首次注册应用程序时将用户凭据(姓名和电子邮件)存储到云 Firestore

问题描述 投票:0回答:1

enter image description here

我可以创建新用户,但在将凭据注册到 Firestore 时遇到问题。

有人可以告诉我我做错了什么吗?

这是我注册用户的代码示例。

添加了必要的依赖项和代码

flutter firebase dart
1个回答
0
投票

您在

authStateChanges
时听过活动吗?

尝试将此代码添加到

onInit

FirebaseAuth.instance
  .authStateChanges()
  .listen((User? user) {
    if (user == null) {
       print('User is currently signed out!');
    } else {
       print('User is signed in!');
    }
   });
© www.soinside.com 2019 - 2024. All rights reserved.