ReferenceCounter constructor
ReferenceCounter(
- Pointer<
NativeType> _pointer, { - void disposeFunc()?,
- String debugName = 'Unnamed',
Constructs a ReferenceCounter for the given pointer.
- pointer: The pointer to manage.
disposeFunc
: Optional function to dispose the pointer.debugName
: Optional name for debugging purposes.
Implementation
ReferenceCounter(
this._pointer, {
void Function(Pointer<NativeType>)? disposeFunc,
String debugName = 'Unnamed',
}) : _refCount = calloc<Int32>(),
_disposeFunc = disposeFunc,
_debugName = debugName {
_refCount.value = 1;
}