retainWhere method
Keeps only elements that satisfy test.
final s = Ref({1, 2, 3, 4});
s.retainWhere((e) => e.isEven); // -> {2, 4}
Implementation
void retainWhere(bool Function(T element) test) {
$.removeWhere((e) => !test(e));
notifyChange();
}