这是我的谷歌登录代码..
onPressed: () async{
final GoogleSignInAccount newuser= await GoogleSignIn().signIn();
final GoogleSignInAuthentication newuserauth= await
googleUser.authentication;
final GoogleAuthCredential cred= GoogleAuthProvider.credential(accessToken:
newuserauth.accessToken,idToken: newuserauth.idToken);
await FirebaseAuth.instance.signInWithCredential(cred);
},
我得到的错误如下..
error: A value of type 'OAuthCredential' can't be assigned to a variable of type
'GoogleAuthCredential'. (invalid_assignment at [firebase] lib\firstpage.dart:147)
error: Undefined name 'googleUser'. (undefined_identifier at [firebase]
lib\firstpage.dart:145)
error: A value of type 'GoogleSignInAccount?' can't be assigned to a variable of type
'GoogleSignInAccount'. (invalid_assignment at [firebase] lib\firstpage.dart:144)
这些是我的 pubspec.yaml 中的依赖项。
dependencies:
flutter:
sdk: flutter
firebase_auth: ^3.2.0
firebase_core : ^1.10.0
flutter_spinkit: ^5.1.0
cloud_firestore: ^3.1.0
google_sign_in: ^5.2.1