WasmDatabase.opened constructor

WasmDatabase.opened(
  1. CommonDatabase database, {
  2. bool logStatements = false,
  3. WasmDatabaseSetup? setup,
  4. bool closeUnderlyingOnClose = true,
  5. bool enableMigrations = true,
  6. bool cachePreparedStatements = true,
})

Creates a drift executor for an opened database from the sqlite3 package.

When the closeUnderlyingOnClose argument is set (which is the default), calling QueryExecutor.close on the returned WasmDatabase will also CommonDatabase.dispose the database passed to this constructor.

Using WasmDatabase.opened may be useful when you want to use the same underlying CommonDatabase in multiple drift connections. Drift uses this internally when running integration tests for migrations.

Implementation

factory WasmDatabase.opened(
  CommonDatabase database, {
  bool logStatements = false,
  WasmDatabaseSetup? setup,
  bool closeUnderlyingOnClose = true,
  bool enableMigrations = true,
  bool cachePreparedStatements = true,
}) {
  return WasmDatabase._(
    _WasmDelegate.opened(database, setup, closeUnderlyingOnClose,
        cachePreparedStatements, enableMigrations),
    logStatements,
  );
}