I'm using flutter and firebase auth with google sign in. specifically I'm referring to this Tutorial
but, in that case no redirect after login success. in my case, i want to redirect after login success.
I have made like this on AuthService
Future<FirebaseUser> googleSignIn() async {
loading.add(true);
GoogleSignInAccount googleUser = await _googleSignIn.signIn();
GoogleSignInAuthentication googleAuth = await googleUser.authentication;
final AuthCredential credential = GoogleAuthProvider.getCredential(
accessToken: googleAuth.accessToken,
idToken: googleAuth.idToken,
);
FirebaseUser user = await _auth.signInWithCredential(credential);
updateUserData(user);
print("signed in : " + user.displayName);
loading.add(false);
return user;
}
initState
void initState() {
super.initState();
authService.profile.listen((state) {
print("ini statenya $state");
});
}
and button
CupertinoButton(
color: const Color(0xFFdd4b39),
child: const Text('Google'),
onPressed: () => authService.googleSignIn().then((user) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BeforeDashboard(
uuid: user,
)),
);
})),
But, it only work when i use debug mode. and not redirect on release mode. After choose account popup will be gone but not redirect on dashboard