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

Viewed 67

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 ?

1 Answers

Use the removeWhere method:

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