Future signInWithGoogle()

in ui/lib/modules/auth/services/auth_service.dart [43:65]


  Future<void> signInWithGoogle() async {
    try {

      if (await _googleSignIn.isSignedIn()) {
        googleUser = await _googleSignIn.signInSilently();
      } else {
        googleUser = await _googleSignIn.signIn();
      }

      googleAuth = await googleUser?.authentication;

      authClient = await _googleSignIn.authenticatedClient();

      final credential = GoogleAuthProvider.credential(
        accessToken: googleAuth?.accessToken,
        idToken: googleAuth?.idToken,
      );

      await FirebaseAuth.instance.signInWithCredential(credential);
    } catch (e) {
      throw Exception(e.toString());
    }
  }