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'


I’m using GetX for my project.

I have a little warning with RxList in GetX.

How do I fix this warning?


This is my code:

var questionListItems = RxList<QuestionLookupResponse>();
// ....
Future<void> onInit() async {
  if (questionListItems.value.isNotEmpty) { // <--- Warning
    questionListItems.value.clear(); // <--- Warning


Remove .value. It work. Because Rxlist can be accesses without .value. So… You can use Rxlist directly like list

Answered By – Huu Bao Nguyen

Answer Checked By – Marie Seifert (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *