dispose method

void dispose()
inherited

Call Rust destructors on the backing memory of this pointer.

This function should be run at least once during the lifetime of the program, and can be run many times.

When passed into a Rust function, Rust enacts shared ownership, if this pointer is shared with Rust when dispose is called, ownership is fully transferred to Rust else this pointer is cleared.

Implementation

void dispose() {
  if (!isStale()) {
    var ptr = _ptr;
    _ptr = FrbOpaqueBase.nullPtr();

    staticFinalizer.detach(this);
    dropFn(ptr);
  }
}