我正在尝试在我的 Flutter 应用程序中使用 firbase 进行身份验证。用户登录并进入“已验证”屏幕后,就会显示此错误。
我正在使用具有简单逻辑的 google_sign_in 插件。
bool isAuth = false;
//check if the user is signed in
@override
void initState() {
super.initState();
googleSignIn.onCurrentUserChanged.listen((account) {
handleSignIn(account);
}, onError: (err) {
print("Error signing in: $err");
});
//maintain the signin
googleSignIn.signInSilently(suppressErrors: false).then((account) {
handleSignIn(account);
}).catchError((err) {
print("Error signing in: $err");
});
}
handleSignIn(GoogleSignInAccount account) {
if (account != null) {
print('User signed in!: $account');
setState(() {
isAuth = true;
});
} else {
setState(() {
isAuth = false;
});
}
}
//sign in using google
login() {
googleSignIn.signIn();
}
logout() {
googleSignIn.signOut();
}
Widget buildAuthScreen() {
return Center(
child: RaisedButton(
child: Text("LogOut"),
onPressed: logout(),
),
);
}
然后 unauth 屏幕具有用于登录的基本登录布局...
如果你没有做任何不必要的事情main
,你可以忽略它。
跳帧数取决于:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)