DynamicCache class final

Implemented types

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream Stream<HashMap<String, dynamic>>
no setter
value Map<String, dynamic>
The current value of the object. When the value changes, the callbacks registered with addListener will be invoked.
no setteroverride

Methods

add(String key, dynamic value, {bool autoRemove = true, Duration expiration = const Duration(seconds: 60), bool listen = true}) → void
Add a key/value pair to the cache, if the key is not already in the cache. Specify the duration of the cache entry (default 30 seconds).
override
addListener(void listener()) → void
Register a closure to be called when the object notifies its listeners.
override
clear() → void
Remove all keys from the cache and notify listeners.
override
contains(String key) bool
Verify if a key exists in the cache.
override
dispose() → void
get<T>(String key) → T?
Get a value from the cache by key.
override
getByType<T>() → T?
Get a first (if there is more than one) value from the cache by type.
override
getOrAdd<T>(String key, {required Future<T> addValue(), bool autoRemove = true, Duration expiration = const Duration(seconds: 60), bool listen = true}) Future<T>
Try to get a value from the cache by key. if the key is not in the cache, will be created.
override
getOrAddSync<T>(String key, {required T addValue, bool autoRemove = true, Duration expiration = const Duration(seconds: 60), bool listen = true}) → T
Try to get a value from the cache by key. if the key is not in the cache, will be created sync.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove(String key, {bool listen = true}) → void
Remove a key from the cache.
override
removeListener(void listener()) → void
Remove a previously registered closure from the list of closures that the object notifies.
override
toString() String
A string representation of this object.
inherited
update<T>(String key, T update(T current)?, {bool listen = true}) → void

Operators

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

Constants

instance → const DynamicCache
Get a DynamicCache instance.