depth property

int get depth

Gets the depth of the node within the tree.

Implementation

int get depth {
  if (isRoot) {
    return 0;
  } else {
    return parent!.depth + 1;
  }
}