idOf method

NodeId idOf(
  1. TreePath path
)

The identity key of path under this policy.

The key is the canonical TreePath.toString, case-folded when caseSensitive is false with the package's Unicode 18.0.0 simple case folding (see caseSensitive), so the same path has the same id on every platform. Two paths are the same tree node exactly when their ids are equal. path should come from this policy's parse; the key is computed from its canonical string either way. Runs in O(path length).

Implementation

NodeId idOf(TreePath path) {
  final string = path.toString();
  return NodeId(caseSensitive ? string : foldCase(string));
}