retainAll method

  1. @override
void retainAll(
  1. Iterable<Object?> elements
)
override

Removes all elements of this Watcher's value that are not elements in elements.

Checks for each element of elements whether there is an element in this set that is equal to it (according to this.contains), and if so, the equal element in this Watcher's value is retained, and elements that are not equal to any element in elements are removed.

final charactersWatcher = <String>{'A', 'B', 'C'}.watcher;
characters.retainAll({'A', 'B', 'X'});
print(characters); // {A, B}

Implementation

@override
void retainAll(Iterable<Object?> elements) =>
    updateOnAction(() => value.retainAll(elements));