decodeAndCollectKnownLeafs method

List<int> decodeAndCollectKnownLeafs(
  1. Uint8List input,
  2. List<TypeRef> typeRefs
)

Implementation

List<int> decodeAndCollectKnownLeafs(Uint8List input, List<TypeRef> typeRefs) {
  final idToLookups = <int, List<int>>{};
  for (var i = 0; i < lookup.length; i++) {
    final look = lookup[i];
    final arr = idToLookups[look.typeId];
    if (arr != null) {
      arr.add(i);
    } else {
      idToLookups[look.typeId] = [i];
    }
  }

  final result = <int>{};
  final bytesInput = Input.fromBytes(input);

  for (var i = 0; i < typeRefs.length; i++) {
    final typeRef = typeRefs[i];
    innerDecodeAndCollect(bytesInput, typeRef, idToLookups, result);
  }

  return result.toList()..sort();
}