MyoroLocalDatabase class

Singleton that creates an offline SQLite database for storing things such as shared preferences.

A note on where & whereArgs arguments.

  • where: SQL syntax placeholders of the condition you are creating, i.e. 'foo = ?', 'foo = ? AND bar = ? OR baz = ?';
  • whereArgs: List of the values of the placeholders, i.e. 'foo', 'foo', true, 5;

Constructors

MyoroLocalDatabase.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() Future<void>
Closes the database.
delete(String tableName, {String? where, List<Object?>? whereArgs}) Future<int>
DELETE operation.
executeSql(String sql) Future<void>
Function to execute raw SQL.
get(String tableName, {String? where, List<Object?>? whereArgs}) Future<Map<String, dynamic>?>
Get operation. Selects the first row of a select operation or null if the result of the select call is empty.
insert(String tableName, {required Map<String, dynamic> data}) Future<int>
INSERT operation. Returns the ID of the newly created row or throws if unsuccessful.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rawSqlQuery(String sql, [List<Object?>? arguments]) Future<List<Map<String, Object?>>>
Function to execute a raw query and return the result of the query.
select(String tableName, {String? where, List<Object?>? whereArgs}) Future<List<Map<String, dynamic>>>
SELECT operation. Returns the list of a given query.
toString() String
A string representation of this object.
inherited
update(String tableName, {required Map<String, dynamic> data, String? where, List<Object?>? whereArgs}) Future<int>
UPDATE operation.

Operators

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

Static Properties

instance MyoroLocalDatabase
no setter

Static Methods

initialize({required String fileName, String? path, String? sql, bool cleanRun = false}) Future<void>
Initializes the database.