When you click on the button, a window appears with a choice of Google account, I choose and instead of switching to a new page, I get an error. Error in the screenshot
My code:
import 'package:google_sign_in/google_sign_in.dart';
GoogleSignIn googleAuth = GoogleSignIn();
final FirebaseAuth _fAuth = FirebaseAuth.instance;
final GoogleSignIn _gSignIn = GoogleSignIn();
Future<FirebaseUser> _signInGoogle() async {
GoogleSignInAccount googleSignInAccount = await _gSignIn.signIn();
GoogleSignInAuthentication authentication = await googleSignInAccount.authentication;
var signInWithGoogle = signInWithGoogle;
FirebaseUser user = await _fAuth.signInWithGoogle(
idToken: authentication.idToken,
accessToken: authentication.accessToken
);
return user;
}
onPressed:() async {
await _signInGoogle();
Navigator.of(context).pushReplacementNamed('/home_screen');
}