DriftWebStorage.indexedDb constructor

  1. @experimental
DriftWebStorage.indexedDb(
  1. String name,
  2. {bool migrateFromLocalStorage,
  3. bool inWebWorker}
)

An experimental storage implementation that uses IndexedDB.

This implementation is significantly faster than the default implementation in local storage. Browsers also tend to allow more data to be saved in IndexedDB.

When the migrateFromLocalStorage parameter (defaults to true) is set, old data saved using the default DriftWebStorage will be migrated to the IndexedDB based implementation. This parameter can be turned off for applications that never used the local storage implementation as a small performance improvement.

When the inWebWorker parameter (defaults to false) is set, the implementation will use WorkerGlobalScope instead of window as it isn't accessible from the worker.

However, older browsers might not support IndexedDB.

Implementation

@experimental
factory DriftWebStorage.indexedDb(String name,
    {bool migrateFromLocalStorage, bool inWebWorker}) = _IndexedDbStorage;