ReferenceCounter mixin
Mixin class for DisposeHandler - mostly used with LazyControl and ControlModel. Counts references by hashCode. References must be added/removed manually.
When there is 1 or more reference then preferSoftDispose is set.
- Superclass Constraints
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- preferSoftDispose ↔ bool
-
requestDispose will execute softDispose. Useful for items in list and objects store in ControlFactory. Final dispose must be handled manually.
getter/setter pairinherited-setteroverride-getter
- preventDispose ↔ bool
-
requestDispose do nothing if set. Final dispose must be handled manually.
getter/setter pairinherited
- referenceCount → int
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addReference(
Object object) → void -
Reference is passed by given
object
, but only Object.hashCode is store, to prevent 'shady' two way referencing (so native GC will not be affected). When there is 1 or more reference then preferSoftDispose is set. -
clear(
) → void - Clears all references. So preferSoftDispose is not set.
-
dispose(
) → void -
Used to clear and dispose object.
After this method call is object typically unusable and ready for GC.
Can be called multiple times!
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeReference(
Object object) → void -
Removes reference of given
object
. When there is 1 or more reference then preferSoftDispose is set. -
requestDispose(
[dynamic parent]) → void -
Executes dispose based on preventDispose and preferSoftDispose settings.
parent
- actual object that requesting dispose.override -
softDispose(
) → void -
Just soft dispose - stop loading / subscriptions etc.
For example called when List item hides and is recycled.
Also useful when Control is used with multiple Widgets to prevent fatal dispose.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited