Flutter: How to listen to the FirebaseUser is Email verified boolean?

后端 未结 8 742
走了就别回头了
走了就别回头了 2021-01-01 20:38

My Idea: I want to use the Firebase Auth Plugin in Flutter to register the users. But before they can access the App, they have to verify their Email addres

8条回答
  •  情书的邮戳
    2021-01-01 21:06

    I have found a way by updating firebase user profile and calling it in init() like below function.

    void _checkEmailVerification() async {
        await widget.auth.getCurrentUser().then((user) {
          UserUpdateInfo userUpdateInfo = new UserUpdateInfo();
          userUpdateInfo.displayName = user.displayName;
          user.updateProfile(userUpdateInfo).then((onValue) {
            setState(() {
              _isEmailVerified = user.isEmailVerified;
            });
          });
        });
      }
    

提交回复
热议问题