DatabaseImplementation enum
An implemented mechanism to use SQLite on the web.
Due to the large variety of browsers and the web standards they support, a number of implementations are available. The most important are:
- opfsShared: Only available on Firefox, but very efficient.
- opfsWithExternalLocks: Only available on recent Chrome versions, also quite efficient.
- opfsAtomics: Only available when using COEP and COOP headers, but also reasonably efficient and supported across browsers.
- indexedDbShared: A less efficient IndexedDB-based implementation used as a fallback on older Chrome versions.
All other options are not recommended, but may be selected if there's no better option (e.g. older Chrome versions on Android may use indexedDbUnsafeWorker).
Values
- inMemoryLocal → const DatabaseImplementation
-
Host an in-memory database in the current tab.
This isn't really useful outside of tests.
const DatabaseImplementation(StorageMode.inMemory, AccessMode.inCurrentContext) -
Host an in-memory database in a shared worker.
This isn't really useful outside of tests.
const DatabaseImplementation(StorageMode.inMemory, AccessMode.throughSharedWorker) - indexedDbUnsafeLocal → const DatabaseImplementation
-
Open an IndexedDB database with a dedicated worker per tab.
There is no concurrency control between these tabs, so this effectively does not support multiple tabs. It's mostly included for legacy reasons.
const DatabaseImplementation(StorageMode.indexedDb, AccessMode.inCurrentContext) - indexedDbUnsafeWorker → const DatabaseImplementation
-
Open an IndexedDB database with a dedicated worker per tab.
There is no concurrency control between these tabs, so this effectively does not support multiple tabs. It's mostly included for legacy reasons.
const DatabaseImplementation(StorageMode.indexedDb, AccessMode.throughDedicatedWorker) -
Open an IndexedDB database in a shared worker.
const DatabaseImplementation(StorageMode.indexedDb, AccessMode.throughSharedWorker) - opfsWithExternalLocks → const DatabaseImplementation
-
Open an synchronous database stored in OPFS.
The database is opened with the non-standard
readwrite-unsafeoption, and the web locks API is used to ensure two tabs don't access the same database concurrently.const DatabaseImplementation(StorageMode.opfs, AccessMode.throughDedicatedWorker) - opfsAtomics → const DatabaseImplementation
-
Open an asynchronous database stored in OPFS. It is "syncified" by using a pair of two dedicated workers implementing an RPC channel over shared memory and atomics.
const DatabaseImplementation(StorageMode.opfs, AccessMode.throughDedicatedWorker) -
Open a synchronous database stored in OPFS.
This works by letting a shared worker spawn a dedicated worker. This is supposed to work, but only implemented in Firefox.
const DatabaseImplementation(StorageMode.opfs, AccessMode.throughSharedWorker)
Properties
- access → AccessMode
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- storage → StorageMode
-
final
Methods
-
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
Constants
-
values
→ const List<
DatabaseImplementation> - A constant List of the values in this enum, in order of their declaration.