concatBytes static method

Uint8List concatBytes(
  1. List<Uint8List> arrs
)

Concatenate Uint8List Bytes

Implementation

static Uint8List concatBytes(List<Uint8List> arrs) {
  final r = Uint8List(arrs.fold<int>(0, (sum, a) => sum + a.length));
  // create u8a of summed length
  int pad = 0;
  // walk through each array,
  for (final a in arrs) {
    r.setRange(pad, pad + a.length, a);
    // ensure they have proper type
    pad += a.length;
  }
  return r;
}