InstanceManager class Null safety

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.
read-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

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 non-existent 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