RemoteMemorySource<T> class

A LocalMemorySource which masquerades as a SourceType.remote source.

This source type is not suitable for anything other than tests or API stubs. To use this, insert it at the back of a SourceList's list of sources and script the API behavior you want by first writing data. The SourceList will then be none the wiser when it asks this class for data and returns what you just wrote.

Inheritance

Constructors

RemoteMemorySource({required Bindings<T>? bindings, DateTime now()?, Duration? ttl})
Instantiates a RemoteMemorySource.

Properties

bindings Bindings<T>
All meta information about T necessary to plug arbitrary data types into a Repository.
getter/setter pairinherited
hasBindings bool
Proxy getter for whether bindings has been initialized, either by being passed in via this constructor or by being set by the SourceList.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sourceType SourceType
This lie is the whole point of this class.
getter/setter pairinherited-setteroverride-getter
supportedOperations Set<SourceOperationType>
The operations supported by this loader instance. Defaults to standard CRUD operations.
no setterinherited
ttl Duration?
Duration after which the data should be considered stale. Stale data will not be returned, and will be deleted when requested. There is no other periodic process to remove stale data - if it is never requested again, it will remain in storage indefinitely.
finalinherited

Methods

clear() Future<void>
Removes all data from the local persistence.
inherited
clearForRequest(RequestDetails details) Future<void>
Clears this request from the request cache.
inherited
delete(DeleteOperation<T> operation) Future<DeleteResult<T>>
Clears an item with the given DeleteOperation.itemId if one exists.
inherited
deleteIds(Set<String> ids) Future<void>
Removes these Ids from storage anywhere they may exist, which is why no RequestDetails are needed.
inherited
getById(ReadOperation<T> operation) Future<ReadResult<T>>
Loads the instance of T whose primary key is found at ReadOperation.itemId.
inherited
getByIds(ReadByIdsOperation<T> operation) Future<ReadListResult<T>>
Loads all instances of T whose primary key is in the set at ReadByIdsOperation.itemIds.
inherited
getItems(ReadListOperation<T> operation) Future<ReadListResult<T>>
Loads all instances of T that satisfy any filtes or pagination on ReadListOperation.details.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notReferencedByAnyRequests(Set<String> keys) Future<Set<String>>
Returns the subset of keys that are not referenced by any requests in the cache. This is used to detect whether keys orphaned by a specific write are in fact globally orphaned and should be deleted, or should merely be deleted from that specific request.
inherited
setItem(WriteOperation<T> operation) Future<WriteResult<T>>
Persists WriteOperation.item.
inherited
setItems(WriteListOperation<T> operation) Future<WriteListResult<T>>
Persists all WriteListOperation.items.
inherited
supports(SourceOperationType type) bool
Returns whether this instance supports the given SourceOperationType.
inherited
toString() String
A string representation of this object.
inherited

Operators

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