PowerSyncDatabase.withFactory constructor

PowerSyncDatabase.withFactory(
  1. DefaultSqliteOpenFactory openFactory, {
  2. required Schema schema,
  3. int maxReaders = SqliteDatabase.defaultMaxReaders,
  4. Logger? logger,
})

Open a PowerSyncDatabase with a PowerSyncOpenFactory.

The factory determines which database file is opened, as well as any additional logic to run inside the database isolate before or after opening.

Subclass PowerSyncOpenFactory to add custom logic to this process.

logger defaults to autoLogger, which logs to the console in debug builds.

Implementation

factory PowerSyncDatabase.withFactory(DefaultSqliteOpenFactory openFactory,
    {required Schema schema,
    int maxReaders = SqliteDatabase.defaultMaxReaders,
    Logger? logger}) {
  return PowerSyncDatabaseImpl.withFactory(openFactory,
      schema: schema, maxReaders: maxReaders, logger: logger);
}