I\'m implementing the google sign in method in my project using Firebase Google sign in option, when the add the below line in my code its throwing me the error like:
The method firebaseAuth.signInWithCredential(credential)
returns a value of type AuthResult
, therefore you need to do the following :
AuthResult userDetails = await _firebaseAuth.signInWithCredential(credential);
The other alternative and the better one for your code, is since signInWithCredential
returns AuthResult
and since class AuthResult
contains instance variable user
of type FirebaseUser
, then you can do the following:
FirebaseUser userDetails = (await _firebaseAuth.signInWithCredential(credential)).user;
https://github.com/FirebaseExtended/flutterfire/blob/master/packages/firebase_auth/firebase_auth/lib/src/auth_result.dart#L18