concatBuffers static method

Uint8List concatBuffers(
  1. List<Uint8List?> arrayBuffers
)

Implementation

static Uint8List concatBuffers(List<Uint8List?> arrayBuffers) {
  var totalLength =
      arrayBuffers.map((b) => b!.lengthInBytes).reduce((a, b) => a + b);
  var result = Uint8List(totalLength);
  var offset = 0;
  for (var item in arrayBuffers) {
    result.setAll(offset, item!);
    offset += item.lengthInBytes;
  }
  return result;
}