WebDatabase.withStorage constructor

WebDatabase.withStorage(
  1. DriftWebStorage storage, {
  2. bool logStatements = false,
  3. CreateWebDatabase? initializer,
  4. WebSetup? setup,
  5. bool readIntsAsBigInt = false,
})

A database executor that works on the web.

The storage parameter controls how the data will be stored. The default constructor of DriftWebStorage will use local storage for that, but an IndexedDB-based implementation is available via DriftWebStorage.indexedDb.

The optional setup function can be used to perform a setup just after the database is opened, before drift is fully ready. This can be used to add custom user-defined sql functions or to provide encryption keys in SQLCipher implementations. Please note: With the current web implementation, the database is closed and re-opened whenever it is stored (i.e. after every transaction or insert/update/delete outside of transactions). The setup parameter will also be invoked whenever the database is re-opened.

Implementation

WebDatabase.withStorage(
  DriftWebStorage storage, {
  bool logStatements = false,
  CreateWebDatabase? initializer,
  WebSetup? setup,
  this.readIntsAsBigInt = false,
}) : super(_WebDelegate(storage, initializer, setup, readIntsAsBigInt),
          logStatements: logStatements, isSequential: true);