I am trying to add Google Authentication in my Flutter Application. But my Android studio is not able to find the method signInWithGoogle under Fire
Instead of using fireebaseauth.signInWithGoogle (which is depreciated)
use:
AuthCredential credential = GoogleAuthProvider.getCredential(
idToken: googleSignInAuthentication.idToken,
accessToken: googleSignInAuthentication.accessToken
);
Your code will look like this:
Future handleSign() async {
preferences = await SharedPreferences.getInstance();
setState(() {
loading = true;
});
GoogleSignInAccount googleUser = await googleSignIn.signIn();
GoogleSignInAuthentication googleSignInAuthentication = await googleUser
.authentication;
AuthCredential credential = GoogleAuthProvider.getCredential(
idToken: googleSignInAuthentication.idToken,
accessToken: googleSignInAuthentication.accessToken);
}