removeWhere method

void removeWhere(
  1. bool test(
    1. Node element
    )
)
override

Remove all the child nodes from the children that match the criterion in the provided test

The ValueListenable and removedNodes listeners will also be notified on this operation

Implementation

void removeWhere(bool test(Node element)) {
  final allChildren = childrenAsList.toSet();
  super.removeWhere(test);
  _notifyListeners();
  final remainingChildren = childrenAsList.toSet();
  allChildren.removeAll(remainingChildren);

  if (allChildren.isNotEmpty)
    _notifyNodesRemoved(NodeRemoveEvent(List.from(allChildren)));
}