I'm trying to do authentication with firbase in my Flutter app. Once the user is signed in and goes to the Authenticted screen, this error shows up. I'm using google_signin plugin with simple logics.
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(),
),
);
}
then the unauth screen has basic login layout for signining in...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With