SQLiteWrapperSyncMixin mixin
Use the mixin like this class MyDatabase extends SQLiteWrapperBase with SQLiteWrapperSyncMixin {
- Superclass constraints
- Mixin applications
Properties
- databases → Databases
-
finalinherited
- debugMode ↔ bool
-
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isSyncing ↔ bool
-
Used to verify if a synchronization is in progress
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
streams
→ List<
StreamInfo> -
finalinherited
- syncConfigured ↔ SyncEnabled
-
Holds the current state of the sync configuration
getter/setter pair
-
tableInfos
↔ Map<
String, TableInfo> -
TableInfos should be passed in the contructor
getter/setter pair
Methods
-
closeDB(
{String? dbName}) → Future< void> -
Close the Database and clean up its streams.
inherited
-
delete(
Map< String, dynamic> map, String table, {required List<String> keys, String? dbName = defaultDBName, dynamic tryToLogOperation = true}) → Future<int> -
DELETE the item building the SQL query using the table and the id passed
override
-
execute(
String sql, {List< String> ? tables, List<Object?> params = const [], String? dbName}) → Future -
Executes an SQL statement.
inherited
-
executeBatch(
List< String> sqls, {List<List< ? paramsList, List<Object?> >String> ? dbName, List<List< ? tablesList}) → Future<String> >List> -
Execute a batch of SQL statements in a single round-trip (gRPC) or
sequentially (native). Each statement is processed through execute
so INSERT/UPDATE/DELETE return their scalar result.
inherited
-
fixBoolParams(
List< Object?> params) → List<Object?> -
Convert booleans to integers (true=1, false=0) in a new list.
Does not mutate the original
paramslist.inherited -
generateSecretKey(
) → String - Genereate a new Key that must be saved somewhere by calling the setSecretKey (for instance)
-
getDatabase(
{String? dbName}) → DatabaseCore? -
Returns the internal DatabaseCore instance for the given db name.
Handle with care: exposes the underlying database adapter.
inherited
-
getDatabases(
) → Databases -
Expose the databases object.
inherited
-
getSecretKey(
{required String dbName}) → Future< String?> - Read the secretKey in the DB, returns null if it's not set... If it's set enable encryption by saving it in EncryptHelper
-
getSyncDetails(
{required String dbName}) → Future< SyncDetails?> - Get the current SyncDetails or null if sync is not yet configured
-
getVersion(
{String? dbName}) → Future< int> -
inherited
-
initSyncTables(
{required String dbName}) → Future< void> - Create the sync tables
-
insert(
Map< String, dynamic> map, String table, {String? dbName = defaultDBName, dynamic tryToLogOperation = true}) → Future<int> -
Insert a new record in the passed table based on the map object
and return the new id
override
-
insertInitialSyncData(
{required String dbName}) → Future< void> - Cycle to all the synced tables and populate them with datas...
-
isSyncConfigured(
{required String dbName}) → Future< bool> - Check if the sync is configured reading the sync_details table
-
isWeb(
) → bool -
inherited
-
logOperation(
String tableName, Operation operation, String rowguid, {required String dbName, dynamic force = false}) → Future< void> -
newUUID(
) → String - Generate a new UUID
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
openDB(
String path, {int version = 0, OnCreate? onCreate, OnUpgrade? onUpgrade, String? dbName, bool useGRPC = false}) → Future< DatabaseInfo> -
Open the Database and returns DatabaseInfo with creation status and version.
inherited
-
query(
String sql, {List< Object?> params = const [], FromMap? fromMap, bool singleResult = false, String? dbName}) → Future -
Executes a query and returns the results.
inherited
-
save(
Map< String, dynamic> map, String table, {List<String> ? keys, String? dbName = defaultDBName, dynamic tryToLogOperation = true}) → Future<int> -
Perform an INSERT or an UPDATE depending on the record state (UPSERT)
override
-
setSecretKey(
String value, {required String dbName}) → Future< void> - Store the secretKey in the DB in the sync_encryption table
-
setVersion(
int version, {String? dbName}) → Future< void> -
inherited
-
shouldSync(
{required String dbName}) → Future< bool> - Get the current state of sync, returning true if there are local unsyncronized rows that should be sent to the server
-
toString(
) → String -
A string representation of this object.
inherited
-
transaction<
T> (Future< T> action(), {String? dbName}) → Future<T> -
Execute
actioninside a database transaction.inherited -
update(
Map< String, dynamic> map, String table, {required List<String> keys, String? dbName = defaultDBName, dynamic tryToLogOperation = true}) → Future<int> -
Update a row in the passed table
override
-
updateStreams(
List< String> ? tables) → Future<void> -
Refresh streams that watch any of the
tables. Iftablesis null, all streams are refreshed.inherited -
watch(
String sql, {List< Object?> params = const [], FromMap? fromMap, bool singleResult = false, required List<String> tables, String? dbName}) → Stream -
Returns a Stream that emits results of
sqlwhenevertableschange.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited