cacheSettings property

LocalCacheSettings? cacheSettings
final

Configures the local cache with PersistentCacheSettings or MemoryCacheSettings. It replaces persistenceEnabled and cacheSizeBytes: passing it together with a non default value of either throws a StateError. When null, the cache is configured by those two settings.

As with persistenceEnabled, PersistentCacheSettings only give a persistent cache when FirebaseFirestore.instanceFor gets an openDatabase function. IndexedDbCacheSettings (web only, experimental) need none, and win over that function.

// A memory cache that keeps up to 10 MB of recently used documents.
final Settings settings = Settings(
  cacheSettings: MemoryCacheSettings(
    gcSettings: MemoryLruGcSettings(sizeBytes: 10 * 1024 * 1024),
  ),
);

Implementation

final LocalCacheSettings? cacheSettings;