release method

void release()
inherited

Releases the reference to the underlying ObjC object held by this wrapper. Throws a StateError if this wrapper doesn't currently hold a reference.

Implementation

void release() {
  if (_pendingRelease) {
    _pendingRelease = false;
    _release(_ptr.cast());
    _finalizer.detach(this);
  } else {
    throw StateError(
        'Released an ObjC object that was unowned or already released.');
  }
}