


# signInWithGoogle method




    *[<Null safety>](https://dart.dev/null-safety)*



- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html)

[Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)&lt;[Account](../../wyatt_authentication_bloc/Account-class.md)> signInWithGoogle
()

_<span class="feature">override</span>_



<p>Starts the Sign In with Google Flow.</p>
<p>Throws a SignInWithGoogleFailureInterface if an exception occurs.</p>



## Implementation

```dart
@override
Future<Account> signInWithGoogle() async {
  try {
    // Trigger the authentication flow
    final GoogleSignInAccount? googleUser = await _googleSignIn.signIn();

    // Obtain the auth details from the request
    final GoogleSignInAuthentication? googleAuth =
        await googleUser?.authentication;

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

    final userCredential =
        await _firebaseAuth.signInWithCredential(credential);

    return _addToStream(
      userCredential,
      (account) => SignedInEvent(
        account: account,
      ),
    );
  } on FirebaseAuthException catch (e) {
    throw SignInWithGoogleFailureFirebase.fromCode(e.code);
  } catch (_) {
    throw SignInWithGoogleFailureFirebase();
  }
}
```







