getOriginalPointerAndDispose method

  1. @nonVirtual
P getOriginalPointerAndDispose()

Returns originalPointer and immediately calls structMarkDisposed.

The canonical way to hand the pointer back to C and unload. Gets the pointer, then ensures this instance can no longer be used.

Implementation

@nonVirtual
P getOriginalPointerAndDispose() {
  final pointer = getOriginalPointer();
  structMarkDisposed();
  return pointer;
}