GoogleSignin
GoogleSignin copied to clipboard
A value of type 'AuthResult' can't be assigned to a variable of type 'FirebaseUser'. pls help me with this
Compiler message: lib/sign%20In%20Screen.dart:31:32: Error: A value of type 'AuthResult' can't be assigned to a variable of type 'FirebaseUser'.
- 'AuthResult' is from 'package:firebase_auth/firebase_auth.dart' ('../../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/firebase_auth-0.14.0+5/lib/firebase_auth.dart').
- 'FirebaseUser' is from 'package:firebase_auth/firebase_auth.dart' ('../../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/firebase_auth-0.14.0+5/lib/firebase_auth.dart'). Try changing the type of the left hand side, or casting the right hand side to 'FirebaseUser'. FirebaseUser userDetails = await _firebaseAuth.signInWithCredential(credential); ^ Compiler failed on C:\Users\Vishvajeet\Documents\AppDevelopment\flutter_app_firebase\lib\main.dart Finished with error: Gradle task assembleDebug failed with exit code 1
To fix the above issue,
-
Replace FirebaseUser userDetails = await _firebaseAuth.signInWithCredential(credential);
-
with FirebaseUser userDetails = (await _firebaseAuth.signInWithCredential(credential)).user;
-
stop the app and restart again, it will solve the above issue.