在Flutter中,如何使当前用户从Firebase维护的缓存中登录,以获取电子邮件和密码的登录类型 [英] In flutter how to get current user logged in from the cache maintained by firebase for signin type of email and password
本文介绍了在Flutter中,如何使当前用户从Firebase维护的缓存中登录,以获取电子邮件和密码的登录类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以通过身份验证与用户登录,但是如何获得有关飞镖颤动的当前用户帮助。
I am able to signin with user in my authentication, but how to get current user aid in dart flutter.
我正在尝试这种方式
FirebaseUser user = FirebaseAuth.instance.currentUser;
print(user.uid);
但显示错误为
不能将类型'()->的值赋给firebaseuser类型的变量
A value of type'()-> Future can't be assigned to a variable of type firebaseuser"
推荐答案
我尚不十分了解Flutter,但是从您的错误消息中,我认为这应该可以解决错误
I don't know Flutter well enough yet to be sure, but from your error message, I think this should fix the error
someMethod() async {
FirebaseUser user = await FirebaseAuth.instance.currentUser();
print(user.uid);
}
这篇关于在Flutter中,如何使当前用户从Firebase维护的缓存中登录,以获取电子邮件和密码的登录类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文