A finalizer utility for managing disposers attached to Jolt objects.
JFinalizer provides a mechanism to attach cleanup functions (disposers) to objects that will be automatically executed when the object is garbage collected. This is useful for managing resources that need cleanup but don't have explicit disposal mechanisms.
Example:
final signal = Signal(0);
final subscription = stream.listen((data) {});
JFinalizer.attachToJoltAttachments(signal, () => subscription.cancel());
// subscription will be cancelled when signal is garbage collected
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
joltAttachments
→ Expando<
Set< Disposer> > -
final
-
joltFinalizer
→ Finalizer<
Set< Disposer> > -
final
Static Methods
-
attachToJoltAttachments(
Object target, Disposer disposer) → Disposer - Attaches a disposer to a Jolt object for automatic cleanup.
-
detachFromJoltAttachments(
Object target, Disposer disposer) → void - Detaches a disposer from a Jolt object.
-
disposeObject(
Object target) → void - Disposes an object and executes all attached disposers.
-
getJoltAttachments(
Object target) → Set< Disposer> - Gets all disposers attached to the given object.