depth property

int depth

Indicates how far from the root node this child node is.

If this is the root node, the depth is 0

Implementation

int get depth {
  if (parent != null) {
    var count = 1;
    TreeViewItem? currentParent = parent!;
    while (currentParent?.parent != null) {
      count++;
      currentParent = currentParent?.parent;
    }

    return count;
  }

  return 0;
}