pull<T> function

List<T> pull<T>(
  1. List<T> array,
  2. List<T> values
)

Removes all given values from the array using equality comparisons.

This method mutates the original array.

Usage:

var array = ['a', 'b', 'c', 'a', 'b', 'c'];
pull(array, 'a', 'c');
print(array); // => ['b', 'b']
  • array (List): The list to modify.
  • values (...*): The values to remove.

Returns:

  • (List): Returns the modified list.

Implementation

List<T> pull<T>(List<T> array, List<T> values) {
  array.removeWhere((element) => values.contains(element));
  return array;
}