bytesToUint8Lists static method

List<Uint8List> bytesToUint8Lists(
  1. Uint8List bytes
)

Implementation

static List<Uint8List> bytesToUint8Lists(Uint8List bytes) {
  List<Uint8List> chunks = [];
  var buffer = bytes.buffer;
  int pos = 0;
  while (pos < bytes.length) {
    int size = bytes[pos] * 256 + bytes[pos + 1];
    Uint8List info = Uint8List.view(buffer, pos + 2, size);
    chunks.add(info);
    pos += 2 + size;
  }
  return chunks;
}