StreamResource<K, V> class

Resource used for managing the data. Allows load, invalidate, clear local data or use with delegated _fetch callback.

Constructors

StreamResource(Future<V> _fetch(K key, ResourceFetchArguments? arguments)?, K _resourceKey, CacheDurationResolver<K, V> _cacheDurationResolver, CacheStorage<K, V> _storage)
Creates an instance. Usually you don't need to create directly. It is used inside the repositories.

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

close() Future<void>
Deletes the cached value and closes the resource. After that, it cannot be used.
invalidate() Future<void>
Invalidates the cached value and force a resource reload.
load({bool forceReload = false, void doOnStore(V)?, bool allowEmptyLoading = false, ResourceFetchArguments? fetchArguments}) Stream<Resource<V>>
Trigger resource loading from cache or with _fetch. forceReload reload even if cache is valid. allowEmptyLoading put empty loading to prevent previous SUCCESS to return. doOnStore callback to modify data before putting it in the storage. fetchArguments additional arguments passed to _fetch if provided.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
putValue(V value) Future<void>
Put or replace value by _resourceKey in the storage.
toString() String
A string representation of this object.
inherited
updateValue(V? changeValue(V? value), {bool notifyOnNull = false}) Future<void>
Update value directly in storage.

Operators

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