如何使用 firebase linkWithCredential?我正在尝试将电话号码链接到当前的 firebase 用户。我的问题是 linkWithCredentials 有一个错误 The method 'linkWithCredential' isn't defined for the type 'Function'
这是因为我的 firebase_auth 版本:^0.15.5+3?或者我做错了。
FirebaseAuth.instance.currentUser.linkWithCredential(phoneCredential);
答案 0 :(得分:0)
错误是因为版本。
.currentUser
是 version 0.15.5+3
中的一个方法。 Link
您需要调用该方法来获取 FirebaseUser
实例。
所以你的代码变成如下所示:
await (await FirebaseAuth.instance.currentUser()).linkWithCredential(phoneCredential);