Code snippets and guidelines for common scenarios
writeTransaction
to group statements that can write to the database.
watch
method to watch for changes to the dependent tables of any SQL query.
execute
to run INSERT, UPDATE or DELETE queries.
uploadData
to send local updates to your backend service. If you are using Supabase, see SupabaseConnector.kt for a complete implementation.
hasSynced
property and register a listener to indicate to the user whether the initial sync is in progress.
waitForFirstSync
method which is a suspense function that resolves once the first full sync has completed.
syncStatus.downloadProgress
property. This is especially useful for long-running initial syncs. downloadProgress.downloadedFraction
gives a value from 0.0 to 1.0 representing the total sync progress.
Example (Compose):