slice method

Buffer slice([
  1. int offset = 0,
  2. int? length
])

Creates a new Buffer from a region of this buffer. Items are copied from the range [offset : offset+length]. If length is omitted, the range extends to the end of the buffer. The range must satisfy the relations 0offsetoffset+lengththis.length.

Implementation

Buffer slice([final int offset = 0, final int? length]) {
  final int? end = length != null ? offset + length : null;
  return Buffer.fromList(_data.sublist(offset, end));
}