MemoryDocumentBackend class

A document store in memory: the default (data lives as long as the app runs) and the fake for tests. With requireIndexes, queries that need a composite index not in indexes fail with CloudIndexMissing, as Firestore's do.

Implemented types

Constructors

MemoryDocumentBackend({bool requireIndexes = false, Set<String>? indexes, DateTime now()?})

Properties

collections → Map<String, Map<String, Map<String, Object?>>>
Collection path → id → data.
final
commits ↔ int
Commits made, for tests.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
indexes → Set<String>
Keys of the composite indexes this store has.
final
maxBatchWrites → int
The most writes one commit takes.
no setteroverride
queries → List<(String, CloudQuery)>
Queries run (collection, query), for tests.
final
requireIndexes → bool
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

aggregate(String collection, CloudQuery query, CloudAggregate operation, String field) → Future<num?>
operation over query's documents (field for sum and average), computed by the store.
override
commit(List<DocumentWrite> writes) → Future<void>
Applies writes at once.
override
dispose() → void
get(String collection, String id) → Future<Map<String, Object?>?>
The document id of collection, or null when it doesn't exist.
override
newId(String collection) → String
A new, unused document id for collection.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
query(String collection, CloudQuery query) → Future<List<CloudDocument>>
The documents of collection that query selects.
override
seed(String collection, Map<String, Map<String, Object?>> docs) → void
Puts documents in collection directly (test setup).
toString() → String
A string representation of this object.
inherited
watch(String collection, String id) → Stream<Map<String, Object?>?>
The document, now and on every change (null while it doesn't exist).
override
watchQuery(String collection, CloudQuery query) → Stream<List<CloudDocument>>
query's documents, now and on every change.
override

Operators

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