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'

Issue

I’m using GetX for my project.

I have a little warning with RxList in GetX.

How do I fix this warning?

warning

This is my code:

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

Solution

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.