SqliteDatabase class

A SQLite implementation of DartApiDB using the sqlite3 package.

DbConfig.database is the file path to the SQLite database file. Use ':memory:' for an ephemeral in-memory database.

final db = await DatabaseFactory.create(DbConfig.sqlite('app.db'));
// or in-memory:
final db = await DatabaseFactory.create(DbConfig.sqlite(':memory:'));

Note: SQLite uses positional ? parameters. Pass values in insertion order matching the ? placeholders in your query.

Implemented types
Available extensions

Constructors

SqliteDatabase(DbConfig config)

Properties

config DbConfig
final
hashCode int
The hash code for this object.
no setterinherited
paramStyle DbParamStyle
The SQL parameter placeholder style used by this driver.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() Future<void>
Closes the database connection.
override
connect() Future<void>
Establishes a connection to the database.
override
delete(String table, {required Map<String, dynamic> where}) Future<DbResult>
Deletes one or more rows from the specified table.
override
insert(String table, Map<String, dynamic> data) Future<DbResult>
Inserts a new row into the specified table.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
query(String table) QueryBuilder

Available on DartApiDB, provided by the DbQueryExtension extension

Returns a QueryBuilder targeting table.
rawQuery(String query, {Map<String, dynamic>? values}) Future<DbResult>
Executes a raw SQL query and returns the result.
override
select(String table, {Map<String, dynamic>? where}) Future<DbResult>
Retrieves data from the specified table.
override
toString() String
A string representation of this object.
inherited
transaction<T>(Future<T> callback(DbTransaction tx)) Future<T>
Runs callback inside a database transaction.
override
update(String table, Map<String, dynamic> data, {required Map<String, dynamic> where}) Future<DbResult>
Updates one or more rows in the specified table.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited