decode method

  1. @override
List<T> decode(
  1. ByteBuffer buffer
)
override

Implementation

@override
List<T> decode(ByteBuffer buffer) {
  final byteData = buffer.asByteData();
  final length = byteData.getInt64(0, Endian.big);
  assert(byteData.lengthInBytes == 8 + length * tSizeInBytes);
  final list = List<T?>.filled(length, null);
  for (int i = 0; i < length; i++) {
    final elementBytes = ByteData(tSizeInBytes);
    for (int j = 0; j < tSizeInBytes; j++) {
      elementBytes.setUint8(j, byteData.getUint8(8 + j + i * tSizeInBytes));
    }
    list[i] = _tCodec.decode(elementBytes.buffer);
  }
  return list.cast<T>();
}