signInWithGoogle method

Future<void> signInWithGoogle()

Implementation

Future<void> signInWithGoogle() async {
  final GoogleSignInAccount? gUser = await GoogleSignIn().signIn();

  // Get the GoogleSignInAuthentication
  final GoogleSignInAuthentication? gAuth = await gUser?.authentication;

  // Create a GoogleAuthProvider credential
  final credential = GoogleAuthProvider.credential(
    accessToken: gAuth?.accessToken,
    idToken: gAuth?.idToken,
  );

  await _firebaseAuth.signInWithCredential(credential);
}