slice method

NativeOwnedBuffer slice(
  1. int offset, [
  2. int? end
])

Implementation

NativeOwnedBuffer slice(int offset, [int? end]) {
  _handle.check();
  final stop = RangeError.checkValidRange(offset, end, length);
  final capacity = _handle.api._getInfo(_handle).capacity;
  final id = _handle.api._slice(_handle.id, offset, stop - offset);
  _check(id);
  return NativeOwnedBuffer._(
    _OwnedHandle(_handle.api, id, externalSize: capacity),
    stop - offset,
    growthCopiedBytes,
    inputCopiedBytes,
  );
}