Skip to content

firebase_auth "Use the plugin" typo in example, doesn't build #37146

@mrmax99

Description

@mrmax99

The below example is listed in the firebase_auth plugin page on pub.dev:
https://pub.dev/packages/firebase_auth

Future<FirebaseUser> _handleSignIn() async {
  final GoogleSignInAccount googleUser = await _googleSignIn.signIn();
  final GoogleSignInAuthentication googleAuth = await googleUser.authentication;

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

  final FirebaseUser user = await _auth.signInWithCredential(credential);
  print("signed in " + user.displayName);
  return user;
}

The function "signInWithCredential" returns an AuthResult, which is not the same type as user (FirebaseUser). It should look something like this I think:

final FirebaseUser user = (await _auth.signInWithCredential(credential)).user;

Metadata

Metadata

Assignees

No one assigned

    Labels

    p: firebase_authThe Firebase Auth pluginpackageflutter/packages repository. See also p: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions