简体   繁体   English

使用 FirebaseAuth 的 GetX(更新到 4.1.1) - Flutter 身份验证不起作用

[英]GetX (updated to 4.1.1) with FirebaseAuth - Flutter authentication not working

Since updating GetX 4.1.1 my authentication model has broken.自更新 GetX 4.1.1 以来,我的身份验证 model 已损坏。

This used to work in my code:这曾经在我的代码中工作:

class AuthenticationService extends GetxService {
    final FirebaseAuth _auth = FirebaseAuth.instance;

     Rx<User> _firebaseUser = Rx<User>();   //<--error: 1 positional argument(s) expected, but 0 found.

The main issue here is that 'Rx()' is now an error.这里的主要问题是 'Rx()' 现在是一个错误。 How do I fix this now that I have upgraded to GetX 4.1.1?既然我已经升级到 GetX 4.1.1,我该如何解决这个问题?

I've tried replacing it with User().obs but then the error is: User doesn't have a default constructor.我试过用 User().obs 替换它,但错误是:用户没有默认构造函数。

you can try to change it up like this: Rxn _firebaseUser = Rxn ();您可以尝试像这样更改它: Rxn _firebaseUser = Rxn (); See https://github.com/jonataslaw/getx/issues/1241https://github.com/jonataslaw/getx/issues/1241

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM