RealmSyncExtensions extension
Extension to provide convenience methods for Realm operations with automatic sync_updated_at timestamp management and DBCache diff tracking.
The extensions now automatically create DBCache entries with computed diffs, which SyncHelper consumes to avoid redundant diff computation and ensure no unnecessary server updates are made when data hasn't actually changed.
- on
-
- dynamic
Methods
-
deleteWithSync<
T extends dynamic> (T obj, {required String userId, required String collectionName}) → void -
Available on dynamic, provided by the RealmSyncExtensions extension
Deletes an object and creates a DBCache entry to track the deletion for syncing with the server. -
writeWithSync<
T extends dynamic> (T obj, {required String userId, required String collectionName, required void writeCallback()}) → T -
Available on dynamic, provided by the RealmSyncExtensions extension
Performs a write operation on a specific object and automatically updates its sync_updated_at field, marks it for sync, and creates a DBCache entry with the computed diff. -
writeWithSyncMultiple(
List objects, {required String userId, required String collectionName, required void writeCallback()}) → void -
Available on dynamic, provided by the RealmSyncExtensions extension
Performs a write operation on multiple objects and automatically updates their sync_updated_at fields, marks them for sync, and creates DBCache entries.