ForeignInstanceStub constructor
Constructor for the ForeignInstanceStub takes the handle to the foreign instance along with the foreign finalizer function that frees the foreign instance.
Implementation
ForeignInstanceStub(ffi.Pointer<ffi.Void> handle,
void Function(ffi.Pointer<ffi.Void>) foreignFinalizer) {
if (handle == ffi.nullptr) {
throw InstanceCreateError('Foreign instance handle is null');
}
_handle = handle;
_foreignFinalizer = foreignFinalizer;
_finalizer.attach(this, _FinalizeWrapper(this), detach: this);
}