我是 flutter 新手...我正在尝试获取当前登录用户的状态并使用 firebase 通知侦听器,但我收到此错误,The expression doesn't evaluate to a function, so it can't be invoked.但auth.currentUser我不明白为什么。
下面是我的代码。
_initialize() async{
SharedPreferences prefs = await SharedPreferences.getInstance();
bool loggedIn = prefs.getBool(LOGGED_IN) ?? false;
if(!loggedIn){
_status = Status.Unauthenticated;
}else{
await auth.currentUser().then((currentUser) async{
_user = currentUser;
_status = Status.Authenticated;
_userModel = await _userServices.getUserById(currentUser.uid);
});
}
notifyListeners();
}
}
Run Code Online (Sandbox Code Playgroud) javascript firebase firebase-authentication google-cloud-firestore