why this error occurred with GoogleSignInAccount?

214 Views Asked by At

I'm trying to use Google Sign In Account In but I have error this my code

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();
}
}

and this is the error:

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)

error image

1

There are 1 best solutions below

1
Legend's Zone On

in the last version the problem appear so I used this version google_sign_in: ^5.0.3