retainWhere method
Removes all objects from this list that fail to satisfy test
.
An object o
satisfies test
if test(o)
is true.
final IList<String> numbers = ['one', 'two', 'three', 'four'].lock;
final IList<String> newNumbers = numbers.retainWhere((item) => item.length == 3);
newNumbers.join(', '); // 'one, two'
Implementation
IList<T> retainWhere(Predicate<T> test) {
// TODO: Still need to implement efficiently.
var list = toList(growable: true);
list.retainWhere(test);
return IList._unsafeFromList(list, config: config);
}