SQLiteDB class abstract

SQLite helper class

Implemented types

Constructors

SQLiteDB()
Supply the database's name and version number.

Properties

db Database?
Gets the Database
no setteroverride
error Exception?
Gets the exception if any.
getter/setter pairoverride
fields Map<String, List<String>>
List of the tables and list their fields: Map<String, List>
no setteroverride
hasError bool
Has an error.
no setter
hashCode int
The hash code for this object.
no setterinherited
inError bool
Indicate if there was a recent Database error
no setteroverride
isDatabaseClosedError bool
Was there a 'Database Closed' error
no setteroverride
isDatabaseException bool
Was there a 'Database Exception' error
no setteroverride
isNoSuchTableError bool
Was there a 'No Such Table' error
no setteroverride
isOpenFailedError bool
Was there a 'Open Failed' error
no setteroverride
isReadOnlyError bool
Was there a 'ReadOnly' error
no setteroverride
isSyntaxError bool
Was there a 'Syntax' error
no setteroverride
isUniqueConstraintError bool
Was there a 'Unique Constraint' error
no setteroverride
message String
Get the error message
no setteroverride
name String
String value with the name of the database.
no setteroverride
newrec Map<String, Map<String, dynamic>>
Create a new 'empty' record from a specified data table
no setteroverride
noError bool
There was no error
no setteroverride
recsUpdated int?
How many records were last updated.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
version int
int value greater than zero.
no setteroverride

Methods

close() → void
Close the Database
override
delete(String table, int id) Future<int>
Delete a data table's record by its primary key Returns the number of records effected.
override
deleteRec(String table, {String? where, List? whereArgs}) Future<int>
Delete the specified record by using a where clause from the specified data table
override
disposed() → void
Called in a State object's dispose() function. Usually call close() function to close the Database. Leave the word 'dispose' to subclasses.
override
getRecord(String table, int id) Future<List<Map<String, dynamic>>>
Return a specific record by primary key from a specified data table
override
getRow(String table, int id, Map<String, dynamic> fields) Future<List<Map<String, dynamic>>>
Return the specified fields from a specified record by primary key from a specified data table
override
getTable(String table, {bool? distinct, String? where, List<Object?>? whereArgs, String? groupBy, String? having, String? orderBy, int? limit, int? offset}) Future<List<Map<String, dynamic>>>
Return a List of records from a specified data table.
override
init({bool throwError = false}) Future<bool>
Called in the initState() function or the FutureBuilder(future: parameter Usually calls the open() function to open the Database
override
keyField(String table) Future<String?>
Get the key field for a table
override
mapQuery(List<Map<String, dynamic>> query) List<Map<String, dynamic>>
Return a List of records from a query result
override
newRec(String table, [Map<String, dynamic>? data]) Map<String, dynamic>
Return an 'empty' record map
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onConfigure(Database db) Future<void>
Configure before upgrading or downgrading or after deletedowngrade
onCreate(Database db, int version) Future<void>
abstract method needed to be subclassed.
onDowngrade(Database db, int oldVersion, int newVersion) Future<void>
Downgrade to a lower version.
onOpen(Database db) Future<void>
After opening, upgrading or downgrading.
onUpgrade(Database db, int oldVersion, int newVersion) Future<void>
Upgrade to a higher version.
open({bool throwError = false}) Future<bool>
Opens the Database
override
query(String table, {List<String>? columns, bool? distinct, String? where, List<Object?>? whereArgs, String? groupBy, String? having, String? orderBy, int? limit, int? offset}) Future<List<Map<String, dynamic>>>
Returns a list of record from the specified data table based on its where clause
override
rawDelete(String sqlStmt, [List? arguments]) Future<int>
int cnt = await _this.rawDelete('DELETE FROM Yahoo WHERE id = ?',id);
override
rawInsert(String sqlStmt, [List? arguments]) Future<int>
Executes a raw SQL INSERT query and returns the last inserted row ID.
override
rawQuery(String sqlStmt) Future<List<Map<String, dynamic>>>
Executes a raw SQL SELECT query and returns a list of the rows that were found.
override
rawUpdate(String sqlStmt, [List? arguments]) Future<int>
int count = await database.rawUpdate('UPDATE Test SET name = ?, VALUE = ? WHERE name = ?',"updated name", "9876", "some name");
override
runTxn<T>(T func(), {bool? exclusive}) Future<T>
Initiate a Database transaction All sequences are rolled back in one among them fails.
override
saveMap(String? table, Map<String, dynamic>? values) Future<Map<String, dynamic>>
Save the specified record values to the specified data table Either parameters may be null
override
saveRec(String table, Map<String, dynamic> fldValues) Future<Map<String, dynamic>>
Save the specified record values to the specified data table Neither parameters can be null
override
tableColumns(String table) Future<List<Map<String, dynamic>>>
Return the field names of the specified data table
override
tableNames() Future<List<Map<String, dynamic>>>
Return a list of data tables in the Database
override
toString() String
A string representation of this object.
inherited
updateRec(String table, Map<String, dynamic> fields) Future<Map<String, dynamic>>
Update the specified record from the specified data table
override

Operators

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

Static Methods

getError() Exception?
Retrieve the current Database error if any
setError(Object? ex) → void
Record the current Database error