Cache class

Constructors

Cache({Store? store, DataIdResolver? dataIdFromObject, Map<String, TypePolicy> typePolicies = const {}, Map<String, Set<String>> possibleTypes = const {}, bool addTypename = true, Map<OperationRequest, Map<String, Map<String, dynamic>?>> seedOptimisticPatches = const {}, JsonEquals? jsonEquals})

Properties

addTypename bool
final
dataIdFromObject → DataIdResolver?
final
hashCode int
The hash code for this object.
no setterinherited
jsonEquals JsonEquals
final
optimisticPatchesStream → BehaviorSubject<Map<OperationRequest, Map<String, Map<String, dynamic>?>>?>
final
possibleTypes Map<String, Set<String>>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
store Store
final
typePolicies Map<String, TypePolicy>
final

Methods

clear() → void
Removes all data from the store and from any optimistic patches.
clearOptimisticPatches() → void
removes all optimistic patches
dispose() Future<void>
evict(String entityId, {String? fieldName, Map<String, dynamic> args = const {}, OperationRequest? optimisticRequest}) → void
Removes the entity from the Store as well as from any optimistic patches.
gc() Set<String>
Removes all entities that cannot be reached from one of the root operations.
identify<TData>(TData data) String?
Returns the canonical ID for a given object or reference.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
optimisticReader(String dataId) Map<String, dynamic>?
Reads data for the given dataId from the Store, merging in any data from optimistic patches
readFragment<TData, TVars>(FragmentRequest<TData, TVars> request, {bool optimistic = true}) → TData?
Reads denormalized data from the Cache for the given fragment.
readQuery<TData, TVars>(OperationRequest<TData, TVars> request, {bool optimistic = true}) → TData?
Reads denormalized data from the Cache for the given operation.
release(String entityId) → void
Allows the entity to be garbage collected if it no longer has any references.
removeOptimisticPatch(OperationRequest request) → void
retain(String entityId) → void
Prevents the entity from being garbage collected.
toString() String
A string representation of this object.
inherited
watchFragment<TData, TVars>(FragmentRequest<TData, TVars> request, {bool optimistic = true}) Stream<TData?>
Watches for changes to data in the Cache for the given fragment.
watchQuery<TData, TVars>(OperationRequest<TData, TVars> request, {bool optimistic = true}) Stream<TData?>
Watches for changes to data in the Cache for the given operation.
writeFragment<TData, TVars>(FragmentRequest<TData, TVars> request, TData data, {OperationRequest? optimisticRequest}) → void
Normalizes data for the given fragment and writes it to the Store.
writeQuery<TData, TVars>(OperationRequest<TData, TVars> request, TData data, {OperationRequest? optimisticRequest}) → void
Normalizes data for the given operation and writes it to the Store.

Operators

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