setAll method

void setAll(
  1. int offset,
  2. Iterable<int> bytes
)

Writes a byte array to a region of the buffer starting at offset.

If offset + bytes length exceeds length, the range extends to the end of the buffer.

The offset must satisy the relations 0offsetthis.length.

final Buffer buf = Buffer.fromList([0, 0, 0, 0, 0, 0, 0, 0]);
print(buf); // [0, 0, 0, 0, 0, 0, 0, 0]

buf.setAll(2, [1, 2, 3, 4]);
print(buf); // [0, 0, 1, 2, 3, 4, 0, 0]

buf.setAll(6, [5, 6, 7, 8]);
print(buf); // [0, 0, 1, 2, 3, 4, 5, 6]

Implementation

void setAll(
  final int offset,
  final Iterable<int> bytes,
) {
  _data.setAll(offset, bytes);
}