PersistentCacheIndexManager class

Controls the creation and the lifecycle of the persistent cache indexes of a FirebaseFirestore instance.

A persistent cache index speeds up queries that are executed against the local cache (Source.cache, offline, and the first results of a listener). It is not the same as a Cloud Firestore index: it only exists inside the SDK, on this device, and does not change what a query returns.

To get an instance use FirebaseFirestore.persistentCacheIndexManager. It is null when the instance uses a memory cache.

await firestore.persistentCacheIndexManager?.enableIndexAutoCreation();

Indexes are not used for queries with inequality filters on several fields; those scan the cache, as in the JS SDK. This is the JS SDK's getPersistentCacheIndexManager with enablePersistentCacheIndexAutoCreation, disablePersistentCacheIndexAutoCreation and deleteAllPersistentCacheIndexes.

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

deleteAllIndexes() → Future<void>
Removes all persistent cache indexes. This also deletes the indexes that were configured with the deprecated FirebaseFirestore.setIndexConfiguration.
disableIndexAutoCreation() → Future<void>
Stops creating persistent cache indexes automatically. The indexes that were created by enableIndexAutoCreation still take effect.
enableIndexAutoCreation() → Future<void>
Lets the SDK create persistent cache indexes automatically for the queries it executes against the local cache, when it believes that an index helps: the query scanned at least 100 documents and less than half of them were results.
fillIndexes({int? maxDocuments}) → Future<int>
Fills the persistent cache indexes now instead of waiting for the background runs, for example while a loading screen is shown. Returns the number of documents indexed.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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