getx RxMap flutter

Issue

Could you help me, use package getx, when I use RxMap with the add method it does not let me add to the RxMap, check the getx package, but the add method is not in the rxmap
enter image description here

enter image description here

Solution

You can simply do like this using RxMap, Instead of add use like this

final mapObject = RxMap();
mapObject['test'] = 'item';
print(mapObject);

Output:

{test: item}

So, In your case

void addMapItem(){
mapItems[DateTime.now().toString()] = DateTime.now().toString();
}

Answered By – Mohan Sai Manthri

Answer Checked By – Timothy Miller (FlutterFixes Admin)

Leave a Reply

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