A lightweight, generic wrapper representing a tracked runtime resource managed by the JetLeaf garbage collection system.
Garbage provides a uniform abstraction for associating an arbitrary runtime object with a stable string key, enabling deterministic lookup, lifecycle management, and cleanup.
Purpose
This class exists to:
- Associate runtime objects with a unique identifier
- Enable cache- and lifecycle-aware management of resources
- Serve as the atomic unit stored inside a GarbageCollector
The generic type T represents the actual source object being tracked.
Generic Handling
The class is annotated with @Generic(Garbage) to ensure JetLeaf can
correctly resolve and materialize generic metadata at runtime.
Example
final garbage = collector.getGarbage<MyService>('service:auth');
print(garbage?.getSource());
- Mixed-in types
- Annotations
-
- @Generic(Garbage)
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
-
equalizedProperties(
) → List< Object?> -
Mixin-style contract for value-based equality,
hashCode, andtoString.inherited -
getKey(
) → String - Returns the unique identifier associated with this garbage entry.
-
getSource(
) → T - Returns the wrapped source object managed by this garbage entry.
-
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