如何在 User 类上检查用户是否是应用程序的新用户

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

enter image description here

我想检查用户是否是首次在 Firebase 中注册。我知道有 UserCredential 对象附带了额外的 DataAttributes 来检查 .isNewUser 但我如何在快照中执行此操作。

我尝试打印代码,但没有任何结果。

flutter firebase firebase-authentication
1个回答
0
投票

如果无法访问

UserCredential
对象,可以在
creationTime
 中比较 lastSignInTime
user.metadata
属性。如果它们相同或非常接近,则该用户是新用户。

© www.soinside.com 2019 - 2024. All rights reserved.