且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用Firebase身份验证在Flutter中注销用户

更新时间:2022-04-25 07:22:47

Firebase Auth的 signOut 方法是吗?异步。您应该使 _signOut 方法 async 并调用 await FirebaseAuth.instance.signOut();。 ,以便在用户注销后调用 runApp

Firebase auth's signOut method is asynchronous. You should make your _signOut method async and call await FirebaseAuth.instance.signOut(); so that the call to runApp occurs after the user is signed out.

您如果要让 signIn 向用户显示身份验证对话框,则在注销时也应调用 _googleSignIn.signOut()并自动重用当前的Google用户。

You should also call _googleSignIn.signOut() when logging out if you want signIn to present the user with an authentication dialog instead of silently and automatically re-using the current Google user.