PowerSyncDatabase constructor

PowerSyncDatabase({
  1. required Schema schema,
  2. required String path,
  3. Logger? logger,
  4. @Deprecated("Use [PowerSyncDatabase.withFactory] instead.") SqliteConnectionSetup? sqliteSetup,
})

Open a PowerSyncDatabase.

Only a single PowerSyncDatabase per path should be opened at a time.

The specified schema is used for the database.

A connection pool is used by default, allowing multiple concurrent read transactions, and a single concurrent write transaction. Write transactions do not block read transactions, and read transactions will see the state from the last committed write transaction.

A maximum of maxReaders concurrent read transactions are allowed.

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

Implementation

factory PowerSyncDatabase({
  required Schema schema,
  required String path,
  Logger? logger,
  @Deprecated("Use [PowerSyncDatabase.withFactory] instead.")
  // ignore: deprecated_member_use_from_same_package
  SqliteConnectionSetup? sqliteSetup,
}) {
  return PowerSyncDatabaseImpl(
    schema: schema,
    path: path,
    logger: logger,
    // ignore: deprecated_member_use_from_same_package
    sqliteSetup: sqliteSetup,
  );
}