成员 'value' 只能在 'package:get/get_rx/src/rx_types/rx_iterables/rx_list.dart' 子类的实例成员中使用
The member 'value' can only be used within instance members of subclasses of 'package:get/get_rx/src/rx_types/rx_iterables/rx_list.dart'
我正在为我的项目使用 GetX。
我对 GetX 中的 RxList 有一点警告。
如何修复此警告?
这是我的代码:
var questionListItems = RxList<QuestionLookupResponse>();
// ....
Future<void> onInit() async {
if (questionListItems.value.isNotEmpty) { // <--- Warning
questionListItems.value.clear(); // <--- Warning
}
}
删除 .value
。这行得通。因为不用.value
也可以访问Rxlist
。所以...你可以像list
一样直接使用Rxlist
我正在为我的项目使用 GetX。
我对 GetX 中的 RxList 有一点警告。
如何修复此警告?
这是我的代码:
var questionListItems = RxList<QuestionLookupResponse>();
// ....
Future<void> onInit() async {
if (questionListItems.value.isNotEmpty) { // <--- Warning
questionListItems.value.clear(); // <--- Warning
}
}
删除 .value
。这行得通。因为不用.value
也可以访问Rxlist
。所以...你可以像list
Rxlist