InstanceManager class

Manages instances.

Maintains two types of instances

  • A strongly typed key mapped to a strongly typed object.
  • A strongly typed key mapped to a weakly typed object.

When a strongly referenced object is added, it must be removed manually. When a weakly referenced object is added, it it removed when it is garbage collected.

Constructors

InstanceManager()
Default constructor for an InstanceManager.

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

addStrongReference({required Object instance, String? instanceId}) bool
Add a new instance with instanceId as key and instance as the value.
addTemporaryStrongReference({required Object instance, String? instanceId, required void onFinalize(String instanceId)}) bool
Add a new instance with instanceId as key and instance as the value.
addWeakReference({required Object instance, String? instanceId, required void onFinalize(String instanceId)}) bool
Add a new instance with instanceId as key and instance as the value.
containsInstance(Object instance) bool
Whether instance is contained in this manager.
generateUniqueInstanceId(Object instance) String
Generate a new unique instance id for instance.
getInstance(String instanceId) Object?
Retrieve the Object paired with instanceId.
getInstanceId(Object instance) String?
Retrieve the instanceId paired with object.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeInstance(String instanceId) → void
Remove the instance with instancedId as key.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited