I want to remove an item from my list in a ListView.builder
but it's saying it's read only.
List<Map> entries = [{'date': '2019-08-10', 'data': 85.0}, {'date': '2019-08-14', 'data': 84.0}];
onPressed: () {
removeItem(index);
}
void removeItem(index) {
entries.removeAt(index);
}
Another exception was thrown: Unsupported operation: read-only
This does not work either:
onPressed: () {
removeItem(date);
}
void removeItem(date) {
entries.removeWhere((item) => item['date'] == date);
}