depth property

int depth

Return the depth of this node in its tree, a root node has depth 0.

Implementation

int get depth {
  var result = 0;
  var current = this;
  while (current.parent != null) {
    current = current.parent!;
    result++;
  }
  return result;
}