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:
A value of type 'AuthResult' can't be assigned to a variable of type 'FirebaseUser'
Here's my Code:
final FirebaseAuth _firebaseAuth = FirebaseAuth.instance;
final GoogleSignIn _googlSignIn = new GoogleSignIn();
Future<FirebaseUser> _signIn(BuildContext context) async {
Scaffold.of(context).showSnackBar(new SnackBar(
content: new Text('Sign in'),
));
final GoogleSignInAccount googleUser = await _googlSignIn.signIn();
final GoogleSignInAuthentication googleAuth =await googleUser.authentication;
final AuthCredential credential = GoogleAuthProvider.getCredential(
accessToken: googleAuth.accessToken,
idToken: googleAuth.idToken,
);
FirebaseUser userDetails = await _firebaseAuth.signInWithCredential(credential).user;
ProviderDetails providerInfo = new ProviderDetails(userDetails.providerId);
List<ProviderDetails> providerData = new List<ProviderDetails>();
providerData.add(providerInfo);
UserDetails details = new UserDetails(
userDetails.providerId,
userDetails.displayName,
userDetails.photoUrl,
userDetails.email,
providerData,
);
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new Profile(detailsUser: details),
),
);
return userDetails;
}
Can someone tell me whats the problem please.