containsMatchingValue method

bool containsMatchingValue(
  1. bool predicate(
    1. T value
    )
)

Whether any value in the tree matches predicate.

Implementation

bool containsMatchingValue(bool Function(T value) predicate) {
  final T? value = this.value;
  if (value != null && predicate(value)) {
    return true;
  }
  for (final MapEntry<ChildKey, ImmutableTree<T>> entry in children.entries) {
    if (entry.value.containsMatchingValue(predicate)) {
      return true;
    }
  }
  return false;
}