decrement method

void decrement()

Decrements the reference count and disposes the pointer if the count reaches zero.

Implementation

void decrement() {
  _checkDisposed();
  _refCount.value--;
  if (_refCount.value == 0) {
    if (_disposeFunc != null) {
      _disposeFunc(_pointer);
    } else {
      calloc.free(_pointer);
    }
    calloc.free(_refCount);
    _isDisposed = true;
  }
}