sqflite 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
OpenDatabaseOptions
Options for opening the database see openDatabase for details
QueryCursor
Cursor for query by page cursor.
Sqflite
sqflite plugin
SqfliteOptions
Class representing SqfliteOptions.
SqflitePlugin
sqflite Plugin registration.
SqfliteSqlCommand
Sql command. internal only.
Transaction
Database transaction to use during a transaction

Enums

ConflictAlgorithm
Insert/Update conflict resolver
SqliteSqlCommandType
Sql command type.

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.
getter/setter pair
databaseFactoryOrNull DatabaseFactory?
Default database factory.
getter/setter pair
databaseFactorySqflitePlugin DatabaseFactory
Default factory that uses the plugin.
no setter

Functions

addGeometryColumnSql(String table, String column, {int srid = 4326, String geometryType = 'POINT', int dimension = 2}) String
Builds the SQL for AddGeometryColumn, SpatiaLite's function for adding a geometry column to an existing table and registering it in geometry_columns metadata.
createSpatialIndexSql(String table, String column) String
Builds the SQL for CreateSpatialIndex, which creates the R*Tree spatial index (idx_<table>_<column>) SpatiaLite uses to accelerate bounding-box filtering for the given geometry column.
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.
discardGeometryColumnSql(String table, String column) String
Builds the SQL for DiscardGeometryColumn, which removes a geometry column's geometry_columns metadata registration (and its spatial index, if any) without dropping the underlying table column.
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
openSpatialDatabase(String path, {OpenDatabaseOptions? options}) Future<Database>
Opens a SpatiaLite-enabled database at path.
recoverSpatialIndexSql(String table, String column) String
Builds the SQL for RecoverSpatialIndex, which rebuilds the R*Tree spatial index for a geometry column.

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 false to stop.

Exceptions / Errors

DatabaseException
Wrap sqlite native exception