nullableDescendants property

Iterable<TreeNode?> get nullableDescendants

Same as descendants but with nullable return, useful when filtering nodes to use orElse: () => null when no node was found.

Implementation

Iterable<TreeNode?> get nullableDescendants sync* {
  for (final child in _children) {
    yield child;
    if (child.hasChildren) {
      yield* child.nullableDescendants;
    }
  }
}