How to Refresh the UI in ListView.Builder using flutter GetX when data is changed? How to Refresh the UI in ListView.Builder using flutter GetX when data is changed? dart dart

How to Refresh the UI in ListView.Builder using flutter GetX when data is changed?


After updating manually your list, do:

this._goalsList.refresh()

After that your UI will be updated


Just Wrap the ListView.builder list with Obx or Getx. For widgets that are not in the list, you can wrap them individually with obx or getx.

Example:

Obx(() => ListView.builder(            physics: const NeverScrollableScrollPhysics(),            itemCount: item.length,            shrinkWrap: true,            itemBuilder: (BuildContext context, int index) {              return Card()...            },          ),        ),


Obs Getx variables are only observed within an Obx or Getx as stated above. You need to wrap them up. Just be careful not to use Obx / Getx when there are no variables observed inside, as it will generate an error.