auth method

  1. @override
Future<AuthProviderUser> auth()
override

Implementation

@override
Future<AuthProviderUser> auth() async {
  if (this.user != null) {
    return this.user;
  }

  GoogleSignInAuthentication? auth;
  try {
    GoogleSignInAccount? account = await _googleSignIn.signIn();
    auth = await account!.authentication;
    id = _googleSignIn.currentUser!.id;
    print(id);
  } catch (e, s) {
    new AppException(true,
        title: "googleAuthFailed",
        code: 500,
        beautifulMsg: "Google Signing didn't work",
        uglyMsg: s.toString());
  }
  Map<String, String> creds = {
    "accessToken": auth!.accessToken.toString(),
    "idToken": id,
  };
  this.user = AuthProviderUser().fromJson(creds);
  return this.user;
}