subBytes method

Byte subBytes(
  1. int start, [
  2. int? end
])

Returns a sub-array of bytes from start to end (exclusive).

Example:

final bytes = Byte.fromList([1, 2, 3, 4, 5]);
final sub = bytes.subBytes(1, 4);
print(sub.toList());  // [2, 3, 4]

Throws RangeError if indices are invalid.

Implementation

Byte subBytes(int start, [int? end]) {
  end ??= _bytes.length;
  return Byte.fromList(_bytes.sublist(start, end));
}