SylvainJack
SylvainJack

Reputation: 1257

How to remove a "List of items" from a list?

I have two lists : _bufferCarnetList and _deletedWords. When the user hits OK: I want to remove from _bufferCarnetList the items contained in _deletedWords.

I have tried using the .remove method, but nothing happens.

_bufferCarnetList.remove(_deletedWords). 

Is there a way to do it in a direct way, or should I iterate the list and remove each item separately ?

Upvotes: 2

Views: 633

Answers (1)

Guillaume Roux
Guillaume Roux

Reputation: 7298

Use the removeWhere method:

_bufferCarnetList.removeWhere((e) => _deletedWords.contains(e));

Upvotes: 4

Related Questions