lookupPath function

Uint8List? lookupPath(
  1. List path,
  2. List tree
)

@param path @param tree

Implementation

Uint8List? lookupPath(List path, List tree) {
  if (path.isEmpty) {
    switch (tree[0]) {
      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);
  }
}