lookupPath function
Implementation
Uint8List? lookupPath(List path, List tree) {
if (path.isEmpty) {
final NodeId nodeId = NodeId.fromValue(tree[0]);
switch (nodeId) {
case NodeId.leaf:
return tree[1] is Uint8List
? tree[1]
: (tree[1] as Uint8Buffer).buffer.asUint8List();
default:
return null;
}
}
final t = findLabel(
path[0] is ByteBuffer ? (path[0] as ByteBuffer).asUint8List() : path[0],
flattenForks(tree),
);
if (t != null) {
return lookupPath(path.sublist(1), t);
}
return null;
}