void main() {
List<Map<String, dynamic>> names = [
{ "id": 1, "name": "John" },
{ "id": 2, "name": "Rick" },
{ "id": 3, "name": "Daryl" },
{ "id": 4, "name": "Alex" }
];
// Remove items if id is greater than or equals to 3
names.removeWhere((item) => item['id'] >= 3);
print(names);
}
If you want to remove items based on two conditions where the name is Rick and id is two then you can use the below syntax.
names.removeWhere((item) => item['id'] == 2 && item['name'] == 'Rick');
0 Comments