findLabel function

List? findLabel(
  1. Uint8List l,
  2. List<List> trees
)

Implementation

List? findLabel(Uint8List l, List<List> trees) {
  if (trees.isEmpty) {
    return null;
  }
  for (final t in trees) {
    final NodeId nodeId = NodeId.fromValue(t[0]);
    if (nodeId == NodeId.labeled) {
      final p =
          t[1] is Uint8List ? t[1] : (t[1] as Uint8Buffer).buffer.asUint8List();
      if (u8aEq(l, p)) {
        return t[2] as List;
      }
    }
  }
  return null;
}