operator - method
Returns a new list of elements from this iterable with the elements from elements excluded.
This operator method uses the except method to create an iterable that excludes
elements found in the elements iterable, and then converts it to a list.
Parameters: elements (Iterable
Returns: List
Example:
List<int> numbers = [1, 2, 3, 4, 5];
List<int> exclude = [2, 3];
List<int> result = numbers - exclude; // Returns [1, 4, 5]
Note: The returned list is a new instance and does not modify the original iterable.
Implementation
List<T> operator -(Iterable<T> elements) => except(elements).toList();