PyRef class
One owned Python reference, automatically registered in the current scope.
Separate references to the same pointer must use separate PyRef instances.
- Implemented types
- Available extensions
Constructors
-
PyRef.fromBorrowedHandle(Pointer<
PyObject> ptr) -
Acquires an independent owned reference from a borrowed pointer.
factory
-
PyRef.fromHandle(Pointer<
PyObject> _ptr) - Takes ownership of an existing new reference, without incrementing it.
Properties
- count → int
-
Available on PyRef, provided by the PyRefDebugExtension extension
no setter - hashCode → int
-
The hash code for this object.
no setteroverride
- isDisposed → bool
-
Whether this resource has already been disposed.
no setteroverride
-
ptr
→ Pointer<
PyObject> -
The native pointer, available only while this reference is alive.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
detachFromScope(
) → PyRef -
Removes this resource from its current automatic ResourceScope so it
survives beyond the scope's lifetime.
override
-
detachToParentScope(
) → PyRef -
Detaches this resource from the current inner ResourceScope and promotes
it to the parent outer scope (if one exists).
override
-
discrement(
) → void - Releases this owned reference. Prefer dispose.
-
dispose(
) → void -
Explicitly releases native memory or resources immediately.
override
-
increment(
) → void - Acquires a raw reference for transfer to native code. Prefer retain when the new reference should be managed by Dart.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
retain(
) → PyRef - Acquires a separately managed reference to the same Python object.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override