SqliteDatabase.withFactory constructor
SqliteDatabase.withFactory(
- SqliteOpenFactory openFactory, {
- int maxReaders = defaultMaxReaders,
Advanced: Open a database with a specified factory.
The factory is used to open each database connection in background isolates.
Use when control is required over the opening process. Examples include:
- Specifying the path to
libsqlite.so
on Linux. - Running additional per-connection PRAGMA statements on each connection.
- Creating custom SQLite functions.
- Creating temporary views or triggers.
Implementation
SqliteDatabase.withFactory(this.openFactory,
{this.maxReaders = defaultMaxReaders}) {
updates = _updatesController.stream;
_listenForEvents();
_internalConnection = _openPrimaryConnection(debugName: 'sqlite-writer');
_pool = SqliteConnectionPool(openFactory,
upstreamPort: _eventsPort.client(),
updates: updates,
writeConnection: _internalConnection,
debugName: 'sqlite',
maxReaders: maxReaders,
mutex: mutex);
_initialized = _init();
}