sqflite_common_ffi library
Classes
- Batch
- A batch is used to perform multiple operation as a single atomic unit. A Batch object can be acquired by calling Database.batch. It provides methods for adding operation. None of the operation will be executed (or visible locally) until commit() is called.
- Database
- Database to send sql commands, created during openDatabase
- DatabaseExecutor
- Common API for Database and Transaction to execute SQL commands
- DatabaseFactory
- Basic databases operations: open, delete, check if a database exists.
- OpenDatabaseOptions
- Options for opening the database see OpenDatabaseOptions.new and openDatabase for details
- QueryCursor
- Cursor for query by page cursor.
- SqfliteFfiIsolatePortServer
- Interface to share the sqflite isolate send port between isolates.
- SqfliteSqlCommand
- Sql command. internal only.
- Transaction
- Database transaction, given to the Database.transaction callback.
Enums
- ConflictAlgorithm
- Insert/Update conflict resolver
- SqliteSqlCommandType
- Sql command type.
Extensions
- DatabaseFactoryLoggerDebugExt on DatabaseFactory
- Debug extension for Logger.
- SqfliteDatabaseExecutorExt on DatabaseExecutor
- Helpers
- SqfliteDatabaseExecutorIterateExt on DatabaseExecutor
- Iterate extension on DatabaseExecutor
- SqfliteDatabaseExt on Database
- Set the journal mode
- SqfliteDatabaseFactoryDebug on DatabaseFactory
- Debug extension
- SqfliteDatabaseFactorySandboxExtension on DatabaseFactory
- Database factory sandbox extension.
- SqfliteSqlCommandExecutorExt on SqfliteSqlCommand
- Extension on SqfliteSqlCommand to execute on a DatabaseExecutor.
Constants
- inMemoryDatabasePath → const String
- Special database name opened in memory
- onDatabaseDowngradeDelete → const OnDatabaseVersionChangeFn
- Downgrading will delete the database and open it again.
- sqfliteLogLevelNone → const int
- No logs
- sqfliteLogLevelSql → const int
- Log native sql commands
- sqfliteLogLevelVerbose → const int
- Log native verbose
Properties
- databaseFactory ↔ DatabaseFactory
-
sqflite Default factory, used by the global
openDatabase(),deleteDatabase(),getDatabasesPath()...getter/setter pair - databaseFactoryFfi → DatabaseFactory
-
The sqflite database factory using ffi (
package:sqlite3).no setter - databaseFactoryFfiNoIsolate → DatabaseFactory
-
The database factory to use for ffi without isolate
no setter
- databaseFactoryOrNull ↔ DatabaseFactory?
-
Default database factory.
getter/setter pair
Functions
-
createDatabaseFactoryFfi(
{SqfliteFfiInit? ffiInit, bool noIsolate = false, SqfliteFfiIsolatePortServer? isolatePortServer}) → DatabaseFactory -
Creates an FFI database factory.
Optionally the
ffiInitfunction can be provided to run some code before SQLite is used (in the sqflite isolate, or in the calling isolate whennoIsolateis true), once. This function should be either a top level function or a static function. If it throws, the database call fails with that error and the next call tries again. Prefer the use of the databaseFactoryFfi getter if you don't need this functionality. -
databaseExists(
String path) → Future< bool> - Check if a database exists at a given path.
-
deleteDatabase(
String path) → Future< void> - Delete the database at the given path.
-
getDatabasesPath(
) → Future< String> - Get the default databases location.
-
onDatabaseVersionChangeError(
Database db, int oldVersion, int newVersion) → Future< void> - to specify during openDatabase for OpenDatabaseOptions.onDowngrade Downgrading will always fail
-
openDatabase(
String path, {int? version, OnDatabaseConfigureFn? onConfigure, OnDatabaseCreateFn? onCreate, OnDatabaseVersionChangeFn? onUpgrade, OnDatabaseVersionChangeFn? onDowngrade, OnDatabaseOpenFn? onOpen, bool? readOnly = false, bool? singleInstance = true, OpenDatabaseOptions? options}) → Future< Database> - Open the database at a given path
-
openReadOnlyDatabase(
String path, {bool? singleInstance = true}) → Future< Database> - Open the database at a given path in read only mode
-
sqfliteFfiInit(
) → void - Initialize ffi loader, call it once before using databaseFactoryFfi.
Typedefs
-
OnDatabaseConfigureFn
= FutureOr<
void> Function(Database db) - Prototype of the function called before calling OpenDatabaseOptions.onCreate/OpenDatabaseOptions.onUpgrade/OpenDatabaseOptions.onOpen when the database is open.
-
OnDatabaseCreateFn
= FutureOr<
void> Function(Database db, int version) - Prototype of the function called when the database is created.
-
OnDatabaseOpenFn
= FutureOr<
void> Function(Database db) - Prototype of the function called when the database is open.
-
OnDatabaseVersionChangeFn
= FutureOr<
void> Function(Database db, int oldVersion, int newVersion) - Prototype of the function called when the version has changed.
-
SqfliteCursorRowCallback
= FutureOr<
bool> Function(Map<String, Object?> row) -
Callback for iteration. Return
falseto stop. - SqfliteFfiInit = void Function()
- Signature responsible for overriding the SQLite dynamic library to use.
Exceptions / Errors
- DatabaseException
- Wrap sqlite native exception