我正在尝试使用Google登录帐户,但我的代码出错
class AuthViewModel extends GetxController{
GoogleSignIn _googleSignIn = GoogleSignIn(scopes: ['email']);
FirebaseAuth _auth = FirebaseAuth.instance;
@override
void onInit() {
// TODO: implement onInit
super.onInit();
}
@override
void onReady() {
// TODO: implement onReady
super.onReady();
}
@override
void onClose() {
// TODO: implement onClose
super.onClose();
}
void googleSignInMethod()async{
final GoogleSignInAccount googleUser = await _googleSignIn.signIn();
}
}这就是错误:
error: A value of type 'GoogleSignInAccount?' can't be assigned to a variable of type 'GoogleSignInAccount'. (invalid_assignment at [ecommerce_app_getx_mvvm] lib\core\viewmodel\auth_view_model.dart:24)

发布于 2021-05-15 02:15:07
在上一个版本中出现了这个问题,所以我使用了这个版本的google_sign_in:^5.0.3
https://stackoverflow.com/questions/67538735
复制相似问题