subset method

List<int> subset(
  1. int start, [
  2. int? end
])

Implementation

List<int> subset(int start, [int? end]) {
  if (_bufferPosition > 0) {
    flush();
  }

  final pos = _fileHandle.position;
  if (start < 0) {
    start = pos + start;
  }
  var length = 0;
  if (end == null) {
    end = pos;
  } else if (end < 0) {
    end = pos + end;
  }
  length = (end - start);
  _fileHandle.position = start;
  final buffer = Uint8List(length);
  _fileHandle.readInto(buffer);
  _fileHandle.position = pos;
  return buffer;
}