WasmDatabase.inMemory constructor

WasmDatabase.inMemory(
  1. CommonSqlite3 sqlite3,
  2. {WasmDatabaseSetup? setup,
  3. bool logStatements = false,
  4. bool cachePreparedStatements = true}
)

Creates an in-memory database in the loaded sqlite3 database.

If an in-memory database is all you need, it can be created more easily than going through the path with open. In particular, you probably don't need a web worker hosting the database.

To create an in-memory database without workers, one can use:

final sqlite3 = await WasmSqlite3.loadFromUrl(Uri.parse('/sqlite3.wasm'));
sqlite3.registerVirtualFileSystem(InMemoryFileSystem(), makeDefault: true);

WasmDatabase.inMemory(sqlite3);

Implementation

factory WasmDatabase.inMemory(
  CommonSqlite3 sqlite3, {
  WasmDatabaseSetup? setup,
  bool logStatements = false,
  bool cachePreparedStatements = true,
}) {
  return WasmDatabase._(
    _WasmDelegate(sqlite3, null, setup, null, cachePreparedStatements),
    logStatements,
  );
}