signInWithGoogle method

Future signInWithGoogle()

SignIn With Google

Implementation

Future signInWithGoogle() async {
  try {
    final GoogleSignInAccount? googleUser =
        await _googleSignIn.authenticate();

    if (googleUser == null) return;
    final googleAuth = googleUser.authentication;
    final credential = GoogleAuthProvider.credential(
      idToken: googleAuth.idToken,
    );

    final result = await _auth.signInWithCredential(credential);
    return result.user!;
  } on FirebaseAuthException catch (e) {
    debugPrint("Authentication Error: $e");
  }
}