dispose method

void dispose()
inherited

Disposes the resource.

Implementation

void dispose() {
  if (!isDisposed) {
    // Forget it before calling `releaseFn`.
    // If the contrary, when something bad happens in between,
    // the data will be released at least twice - one by calling releaseFn,
    // another by future call to `dispose` or the auto invocation of `finalizer`.
    final ptr = _ptr!;
    forget();
    staticData._releaseFn(ptr);
  }
}