loginOrSignUpGoogle method

Future<bool> loginOrSignUpGoogle()

Implementation

Future<bool> loginOrSignUpGoogle() async {
  try {
    _googleSignIn = GoogleSignIn(
      scopes: [
        'email',
        'https://www.googleapis.com/auth/userinfo.profile',
      ],
    );
    GoogleSignInAccount? account = await _googleSignIn!.signIn();
    if (account != null) {
      GoogleSignInAuthentication auth = await account.authentication;
      return await socialLogin(auth, 'google');
    }

    throw tr('invalid_authentication');
  } catch (e) {
    rethrow;
  }
}