decodeIndexedListBytes<T> static method
Decodes an indexed list ([4B count][8B×n offsets][items]) eagerly.
The web copies the framed buffer out of the module heap anyway, so a lazy view buys nothing — decode all items in one pass.
Implementation
static List<T> decodeIndexedListBytes<T>(
Uint8List framed,
T Function(RecordReader r) readItem,
) {
final header = RecordReader.fromFramedBytes(framed);
final count = header.readInt32();
final offsets = List<int>.generate(count, (_) => header.readInt(), growable: false);
return List<T>.generate(
count,
(i) => readItem(RecordReader.fromFramedBytes(framed, offsets[i])),
growable: false,
);
}