subtreeSizeOf method

int subtreeSizeOf(
  1. NodeId id
)

The number of nodes in the subtree of id, including the node itself; 0 when absent. O(1).

The subtree is the slice of nodes starting at indexOf, so a file's subtree size is 1.

Implementation

int subtreeSizeOf(NodeId id) {
  final index = _indexById[id];
  return index == null ? 0 : _subtreeSizes[index];
}