Describe how to open an in-memory wasm database

This commit is contained in:
Simon Binder 2023-09-16 13:26:05 +02:00
parent 909c01bc5d
commit 069c4c76c3
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
1 changed files with 13 additions and 0 deletions

View File

@ -63,6 +63,19 @@ class WasmDatabase extends DelegatedDatabase {
}
/// 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:
///
/// ```dart
/// final sqlite3 = await WasmSqlite3.loadFromUrl(Uri.parse('/sqlite3.wasm'));
/// sqlite3.registerVirtualFileSystem(InMemoryFileSystem(), makeDefault: true);
///
/// WasmDatabase.inMemory(sqlite3);
/// ```
factory WasmDatabase.inMemory(
CommonSqlite3 sqlite3, {
WasmDatabaseSetup? setup,