LazyWeakReferenceManagerByType class
Manages multiple LazyWeakReferenceManager instances grouped by target type, all created using the same configuration.
Each type has its own independent manager responsible for handling lazy weakening of references. Managers are created on demand when requested through get.
This allows reference lifecycle policies to be configured once and shared globally, while keeping references isolated per object type.
Managers process references in batches to avoid blocking the event loop, helping maintain responsiveness for I/O, events, and UI updates.
A global shared instance is available through global.
Constructors
- LazyWeakReferenceManagerByType({Duration weakenDelay = LazyWeakReferenceManager.defaultWeakenDelay, int batchLimit = LazyWeakReferenceManager.defaultBatchLimit, Duration batchInterval = LazyWeakReferenceManager.defaultBatchInterval})
- Creates a manager that lazily provides one LazyWeakReferenceManager per type.
Properties
- batchInterval → Duration
-
Delay between batch processing. Default: 1 ms
final
- batchLimit → int
-
Maximum references processed per batch. Default: 100
final
-
entries
→ Iterable<
MapEntry< Type, LazyWeakReferenceManager< >Object> > -
Returns all
(Type, LazyWeakReferenceManager)MapEntry pairs.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- length → int
-
Number of registered managers.
no setter
-
managers
→ Iterable<
LazyWeakReferenceManager< Object> > -
Returns all active managers.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
types
→ Iterable<
Type> -
Returns all registered types that currently have managers.
no setter
- weakenDelay → Duration
-
Time before a strong reference becomes weak. Default: 1 sec
final
Methods
-
clear(
) → void - Removes all registered managers.
-
get<
T extends Object> () → LazyWeakReferenceManager< T> -
Returns the LazyWeakReferenceManager associated with type
T. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove<
T extends Object> ([Type? type]) → LazyWeakReferenceManager< T> ? -
Removes and returns the manager associated with
Tortype. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- global → LazyWeakReferenceManagerByType
-
Global shared instance using balanced defaults suitable
for most applications.
final