getOpAndDispose method

  1. @nonVirtual
StructPointer<D> getOpAndDispose()

Returns op and immediately disposes this struct.

This is the canonical way to hand a resource-backed struct over to a C API that takes ownership of the underlying memory.

Implementation

@nonVirtual
StructPointer<D> getOpAndDispose() {
  final ptr = getOp();
  structMarkDisposed();
  $state.dispose();
  return ptr;
}