CacheDelta class final

The entities that changed since a Cache.version: what a persistence layer writes to bring its copy up to date, instead of a whole Cache.snapshot. Get one from Cache.changesSince.

changed holds JSON copies of the entities in the Cache.snapshot format (refs as {"__ref": key}); an entity is in changed or in removed, never both. The operation roots (ROOT_QUERY, ROOT_MUTATION, …) are usually reported field by field instead (changedFields / removedFields): they hold one field per query and would otherwise be copied whole whenever one query changed.

Constructors

CacheDelta({required int version, required Map<String, Map<String, Object?>> changed, required Set<String> removed, Map<String, Map<String, Object?>> changedFields = const {}, Map<String, Set<String>> removedFields = const {}, bool full = false})
const

Properties

changed → Map<String, Map<String, Object?>>
Entities written since the requested version, by key.
final
changedFields → Map<String, Map<String, Object?>>
Operation roots changed field by field: per root key, JSON copies of the fields written since the requested version (the root's other fields are unchanged). A root is in changed (copied whole, e.g. in a full delta or after the root itself was removed), in removed, or here (with removedFields): never two of these.
final
full → bool
The delta replaces the whole store: drop every stored entity, then write changed (which is then every entity). Happens after Cache.clear, or when the requested version is older than what the cache still remembers (Cache.compacted away, or forgotten removals).
final
hashCode → int
The hash code for this object.
no setterinherited
isEmpty → bool
no setter
removed → Set<String>
Keys of the entities evicted, collected or removed since then.
final
removedFields → Map<String, Set<String>>
Per root key, the fields removed since the requested version (a mutation's root fields once it settled, a CacheScope remove, an evicted entity a root field pointed to). Never also in changedFields.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
version → int
The Cache.version this delta brings a copy up to: pass it to the next Cache.changesSince once the delta is stored.
final

Methods

applyTo(Map<String, Object?> snapshot) → void
Applies the delta to a stored snapshot (e.g. a JSON file's content) in place.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

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