SQLiteWrapperSyncGRPC class

You can use this class to sync from a GRPC SQLiteWrapper instance that uses a remote sqlite db as a local one

Inheritance
Mixed-in types

Constructors

SQLiteWrapperSyncGRPC({required Map<String, TableInfo> tableInfos, String host = 'localhost', int port = 50051, bool secure = false})

Properties

authClient → AuthClient
no setterinherited
client → SqliteWrapperServiceClient
no setterinherited
clientOverride ↔ SqliteWrapperServiceClient?
getter/setter pairinherited
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 pairinherited
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 pairinherited
tableInfos Map<String, TableInfo>
TableInfos should be passed in the contructor
getter/setter pairinherited
token String
no getterinherited

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
inherited
echo(String message) Future<String>
inherited
execute(String sql, {List<String>? tables, List<Object?> params = const [], String? dbName}) Future
Executes an SQL statement.
inherited
executeBatch(List<String> sqls, {List<List<Object?>>? paramsList, List<String>? dbName, List<List<String>>? tablesList}) Future<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
exportBackup({String? dbName}) Future<List<int>>
Export the entire database as raw bytes (backup).
inherited
exportCSV(String sql, {String? dbName}) Future<String>
Execute a SQL query and return the result as a CSV string.
inherited
fixBoolParams(List<Object?> params) List<Object?>
Convert booleans to integers (true=1, false=0) in a new list. Does not mutate the original params list.
inherited
generateSecretKey() String
Genereate a new Key that must be saved somewhere by calling the setSecretKey (for instance)
inherited
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
inherited
getSyncDetails({required String dbName}) Future<SyncDetails?>
Get the current SyncDetails or null if sync is not yet configured
inherited
getVersion({String? dbName}) Future<int>
inherited
importBackup(Uint8List data, {String? dbName}) Future<ImportBackupResponse>
Import a database from raw bytes (restore). Returns ImportBackupResponse with success status and message.
inherited
initServiceManager({String host = 'localhost', int port = 50051, bool secure = false}) → void
inherited
initSyncTables({required String dbName}) Future<void>
Create the sync tables
inherited
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
inherited
insertInitialSyncData({required String dbName}) Future<void>
Cycle to all the synced tables and populate them with datas...
inherited
isSyncConfigured({required String dbName}) Future<bool>
Check if the sync is configured reading the sync_details table
inherited
isWeb() bool
inherited
logOperation(String tableName, Operation operation, String rowguid, {required String dbName, dynamic force = false}) Future<void>
inherited
newUUID() String
Generate a new UUID
inherited
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)
inherited
setSecretKey(String value, {required String dbName}) Future<void>
Store the secretKey in the DB in the sync_encryption table
inherited
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
inherited
toString() String
A string representation of this object.
inherited
transaction<T>(Future<T> action(), {String? dbName}) Future<T>
Execute action inside 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
inherited
updateStreams(List<String>? tables) Future<void>
Refresh streams that watch any of the tables. If tables is 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 sql whenever tables change.
inherited

Operators

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