DependentCachedValue<CacheContentType, DependencyType> class

A CachedValue that its validity is defined by a dependency. It holds the last result of the computation callback since the last change on the result of the dependency callback.

This cache will be considered invalid if the overall returned value of the dependency callback changes since the last refresh.

Besides dependency change, this cache can also be manually updated on marked as invalid via refresh and invalidate.

The dependency callback is called in every value access. So it is recommended to keep the dependency callback as declarative as possible.

It can be created via CachedValue.withDependency

Inheritance
Available Extensions

Properties

child CachedValue<CacheContentType>
A CachedValue in which this cache wraps.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
isValid bool
Check the current state of the cache.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → CacheContentType
Access the current cache value.
no setteroverride

Methods

invalidate() → void
Marks the cache as invalid.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refresh() → CacheContentType
Calls refresh on its child and updates the local cache of dependency.
override
toString() String
A string representation of this object.
inherited

Operators

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