ancestors property

Iterable<TreeNode> get ancestors

Returns the path from the root node to this node, not including this.

Example: root, child, grandChild, ..., this.parent.

Implementation

Iterable<TreeNode> get ancestors sync* {
  if (parent != null) {
    yield* parent!.ancestors;
    yield parent!;
  }
}