indexedDbCacheSettings function

IndexedDbCacheSettings indexedDbCacheSettings({
  1. int sizeBytes = Settings.defaultCacheSizeBytes,
  2. bool indexAutoCreation = false,
  3. IndexBackfillSettings? indexBackfill,
  4. bool mergeUnsentWrites = false,
  5. bool multiTab = false,
})

Settings for a cache in IndexedDB, in the format of the official Firebase JS SDK (see IndexedDbCacheSettings).

sizeBytes is an approximate cache size threshold, as in PersistentCacheSettings.sizeBytes: the size is the one the JS SDK counts (the JSON length of the cached documents). Use Settings.cacheSizeUnlimited to disable the collection; the minimum is 1 MB, an ArgumentError is thrown otherwise. indexAutoCreation, indexBackfill and mergeUnsentWrites are those of PersistentCacheSettings.

With multiTab the tabs of the app share the cache (see IndexedDbCacheSettings.multiTab).

Throws an UnsupportedError on other platforms than the web.

Implementation

IndexedDbCacheSettings indexedDbCacheSettings({
  int sizeBytes = Settings.defaultCacheSizeBytes,
  bool indexAutoCreation = false,
  IndexBackfillSettings? indexBackfill,
  bool mergeUnsentWrites = false,
  bool multiTab = false,
}) => IndexedDbCacheSettingsInternal.create(
  createIndexedDbPersistence,
  sizeBytes: sizeBytes,
  indexAutoCreation: indexAutoCreation,
  indexBackfill: indexBackfill,
  mergeUnsentWrites: mergeUnsentWrites,
  multiTab: multiTab,
  createSharedClientStateStorage: createWebStorageSharedClientStateStorage,
);