GoogleSignin icon indicating copy to clipboard operation
GoogleSignin copied to clipboard

A value of type 'AuthResult' can't be assigned to a variable of type 'FirebaseUser'. pls help me with this

Open thevishvajeet opened this issue 5 years ago • 1 comments

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

thevishvajeet avatar Oct 03 '19 17:10 thevishvajeet

To fix the above issue,

  1. Replace FirebaseUser userDetails = await _firebaseAuth.signInWithCredential(credential);

  2. with FirebaseUser userDetails = (await _firebaseAuth.signInWithCredential(credential)).user;

  3. stop the app and restart again, it will solve the above issue.

Wizpna avatar Jan 05 '20 08:01 Wizpna