Db class

A class to handle database operations

Constructors

Db({Database sqfliteDatabase})
An empty database. Has to be initialized with init

Properties

changefeed Stream<DatabaseChangeEvent>
A stream of DatabaseChangeEvent with all the changes that occur in the database
read-only
database Database
This Sqflite Database
read-only
file File
This Sqlite file
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
hasSchema bool
Check the existence of a schema
read-only
isReady bool
This database state
read-only
onReady Future<void>
The on ready callback: fired when the database is ready to operate
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
schema DbSchema
This database schema
read-only
sqfliteDatabase Database
An Sqlite database: [...]
final

Methods

batchInsert({String table, List<Map<String, String>> rows, ConflictAlgorithm conflictAlgorithm = ConflictAlgorithm.rollback, bool verbose = false}) Future<List>
Insert rows in a table
count({String table, String where, String columns = "id", bool verbose = false}) Future<int>
count rows in a table
delete({String table, String where, bool verbose = false}) Future<int>
Delete some datapoints from the database
dispose() → void
Dispose the changefeed stream when finished using
exists({String table, String where, bool verbose = false}) Future<bool>
Check if a value exists in the table
init({String path, bool absolutePath = false, List<String> queries = const <String>[], List<DbTable> schema = const <DbTable>[], bool verbose = false, String fromAsset, bool debug = false}) Future<void>
Initialize the database [...]
insert({String table, Map<String, String> row, bool verbose = false}) Future<int>
Insert a row in a table [...]
insertIfNotExists({String table, Map<String, String> row, bool verbose = false}) Future<int>
Insert a row in a table if it is not present already [...]
@Deprecated("The insertIfNotExists function will be removed after version 4.4.0")
insertManageConflict({String table, ConflictAlgorithm conflictAlgorithm, Map<String, dynamic> row, bool verbose = false}) Future<int>
Insert a row in a table with conflict algorithm [...]
join({String table, String joinTable, String joinOn, String columns = "*", int offset, int limit, String orderBy, String where, String groupBy, bool verbose = false}) Future<List<Map<String, dynamic>>>
A select query with a join
mJoin({String table, List<String> joinsTables, List<String> joinsOn, String columns = "*", int offset, int limit, String orderBy, String where, String groupBy, bool verbose = false}) Future<List<Map<String, dynamic>>>
A select query with a join on multiple tables
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
query(String q, {bool verbose = false}) Future<List<Map<String, dynamic>>>
Execute a query
select({String table, String columns = "*", String where, String orderBy, int limit, int offset, String groupBy, bool verbose = false}) Future<List<Map<String, dynamic>>>
A select query
toString() String
A string representation of this object. [...]
inherited
update({String table, Map<String, String> row, String where, bool verbose = false}) Future<int>
Update some datapoints in the database
upsert({String table, Map<String, String> row, List<String> preserveColumns = const [], String indexColumn, bool verbose = false}) Future<void>
Insert a row if it does not exist or update it [...]

Operators

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