writeBlocks method

int writeBlocks(
  1. Iterable<Uint8List> blocks
)

Writes a lists of bytes blocks. Uses writeBlock32.

Implementation

int writeBlocks(Iterable<Uint8List> blocks) {
  var blocksSz = blocks.isEmpty
      ? 0
      : blocks
          .map((e) => e.length)
          .reduce((value, element) => value + 4 + element);

  final writeSz = 4 + 4 + blocksSz;
  bytesIO.ensureCapacity(bytesIO.position + writeSz);

  writeInt32(blocks.length);
  var sz = 4;

  for (var block in blocks) {
    sz += writeBlock32(block);
  }

  return sz;
}