如何在Flutter Firebase UI中获取AuthResult以查找其他用户信息 [英] How to get AuthResult in flutter Firebase UI to find additionalUserInfo
问题描述
我是新手,使用示例代码登录后,我得到了用户,但是我需要确定用户以前是否使用过该应用程序(然后卸载)或在新设备上使用过.我看到了另一个问题获取AuthResult,如下所示,
I am new to flutter and using sample code that does signIn, I get the user, but I need to find if the user has previously used the App ( and then uninstalled) or using on a new device. I see another question that gets the AuthResult as shown below,
AuthResult authResult = await _auth.signInWithCredential(credential);
if (authResult.additionalUserInfo.isNewUser) {
//User logging in for the first time
// Redirect user to tutorial
}
else {
//User has already logged in before.
//Show user profile
}
但是 SignInScreen ,不会返回authResult >
But the SignInScreen, does not return the authResult
SignInScreen(
title: "Demo",
header: new Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: new Padding(
padding: const EdgeInsets.all(16.0),
child: new Text("Demo"),
),
),
showBar: true,
// horizontalPadding: 8,
bottomPadding: 5,
avoidBottomInset: true,
color: Color(0xFF363636),
providers: [
ProvidersTypes.google,
ProvidersTypes.phone,
ProvidersTypes.facebook,
// ProvidersTypes.twitter,
// ProvidersTypes.email
],
twitterConsumerKey: "",
twitterConsumerSecret: "", horizontalPadding: 12,
)
推荐答案
From looking at the code, it looks like the firebase-ui-flutter
library that you're using does not expose the user from the active sign-in operation (calls to signInWith...
).
您要么必须更新库以公开功能,要么编写自己的登录UI,或者找到另一个可以更好地处理它的库.您也可以在存储库中提交错误,但是过去两个维护很少年.有 fork 似乎有更多更新,但
You'll either have to update the library to expose the functionality, write your own sign-in UI, or find another library that handles it better. You could also file a bug on the repo, but it's seen very little maintenance in the past two years. There's a fork that seems more update, but that code also doesn't expose the result from active sign-in.
这篇关于如何在Flutter Firebase UI中获取AuthResult以查找其他用户信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!