getx RxMap 抖动

getx RxMap flutter

你能帮我吗,使用包getx,当我使用RxMap和add方法时它不让我添加到RxMap,检查getx包,但是add方法不在rxmap中

你可以简单地使用 RxMap 这样做,而不是像这样添加使用

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

输出:

{test: item}

所以,在你的情况下

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