sqlite_plus_io library
Optional Pure Dart dart:io adapter. Do not import this library on the Web.
Classes
- Batch
- Statements collected for one commit.
- DatabaseClient
- A logical client. Concurrent operations are serialized by the owner. An explicit transaction belongs to the client that began it; other clients receive StateError until commit/rollback. Lost clients can be recovered by closing the owner, which rolls back uncommitted state.
- DatabaseOwner
- A single connection/handle owner. Share sendPort with other isolates and connect through DatabaseClient; never open additional file handles directly.
- DurableFileStorageBackend
- Read/write access to an EXISTING, durably provisioned regular file.
- MutableSqliteDatabase
- Serialized image mutations with constraints, secondary indexes and row triggers. In-memory by default; an ImagePager supplies the durable commit boundary. Transactions and savepoints retain independent image snapshots.
- OfficialFileStorage
- Read-only open of an official SQLite file.
- PageCursor
- Portable, unsigned continuation token. Never use as authorization.
- PageOrder
- A column ordering, using its declared collation unless explicitly overridden.
- ReadOnlyFileStorageBackend
- Read-only file access, with serialized seek/read operations. No file locking; callers must supply a stable copy without a hot journal or uncheckpointed WAL.
- SqlCipher
- SQLCipher 4 defaults: AES-256-CBC, HMAC-SHA512, and PBKDF2-HMAC-SHA512.
- SqlCipherDatabase
- A plaintext MutableSqliteDatabase whose file image is SQLCipher 4.
- SqlCipherKeys
- Encryption key, HMAC key, and the 16-byte salt stored in the file.
- SqliteLock
-
Byte ranges SQLite locks. Rollback locks are in the database file.
WAL locks are in the
-shmfile, starting at byte 120. -
SqlPage<
T> - Immutable list container. Entity/map/BLOB values follow their normal APIs.
- SqlPagination
-
Keyset paging over a single table/view. The caller guarantees unique,
non-null
keyColumns. No schema/index mutation or hidden COUNT query. - Transaction
- One transaction callback. Its statements use the surrounding connection.
Enums
- ConflictAlgorithm
-
How an
INSERTorUPDATEbehaves when a constraint fails.
Extensions
- DatabaseClientPagination on DatabaseClient
- Cursor pages through the same serialized file-owner client/transaction.
- DatabaseOwnerPagination on DatabaseOwner
- Pages on the owner returned by openDatabase, preserving its client identity.
- MutableDatabasePagination on MutableSqliteDatabase
- ReadOnlyDatabasePagination on SqliteDatabase
Functions
-
openDatabase(
String path, {bool directoryEntriesDurable = true, bool wal = false, int? version, OnDatabaseConfigure? onConfigure, OnDatabaseCreate? onCreate, OnDatabaseVersionChange? onUpgrade, OnDatabaseVersionChange? onDowngrade, OnDatabaseOpen? onOpen}) → Future< DatabaseOwner> - Opens a database file on its own isolate.
-
openFileImage(
String path) → Future< MutableSqliteDatabase> -
Opens
pathas an in-process database image. -
openReadOnlyFile(
String path, {int maxImageBytes = 64 * 1024 * 1024}) → Future< SqliteDatabase> -
Opens
pathfor reading. A pending-walor hot-journalis recovered in memory. The file and its sidecars are not modified. A shared SQLite lock is held until the database is closed. -
openSqlCipher(
String path, String passphrase, {int iterations = SqlCipher.iterations, int pageSize = 4096}) → Future< SqlCipherDatabase> - Reads a SQLCipher 4 database file.
-
saveSqlCipher(
String path, SqlCipherDatabase database) → Future< void> -
Replaces
pathwith the current SQLCipher image.
Typedefs
-
OnDatabaseConfigure
= Future<
void> Function(DatabaseOwner database) - Called once, before the version check.
-
OnDatabaseCreate
= Future<
void> Function(DatabaseOwner database, int version) - Called when the stored version is 0.
-
OnDatabaseOpen
= Future<
void> Function(DatabaseOwner database) - Called after the version check on every open.
-
OnDatabaseVersionChange
= Future<
void> Function(DatabaseOwner database, int oldVersion, int newVersion) - Called when the stored version and the requested version differ.
-
PageQueryRunner
= Future<
QueryResult> Function(String sql, List<Object?> parameters)