pushDelta method
Future<void>
pushDelta({
- required String collection,
- required String recordId,
- required Map<
String, dynamic> delta, - required int baseVersion,
- required DateTime timestamp,
override
Push delta (partial update) to backend.
Only sends changed fields instead of the entire document, reducing bandwidth by up to 98%.
Parameters:
collection: Collection namerecordId: Document IDdelta: Only the fields that changedbaseVersion: Version before this updatetimestamp: When the update occurred
If the backend doesn't support delta sync, this should fall back to a regular push() with the full document.
Implementation
@override
Future<void> pushDelta({
required String collection,
required String recordId,
required Map<String, dynamic> delta,
required int baseVersion,
required DateTime timestamp,
}) async {
// Supabase doesn't have native delta sync support
// Fall back to regular push with delta as the data
// In production, you might want to fetch the full document first,
// merge the delta, and then push the complete document
await client.from(collection).upsert({
'record_id': recordId,
'data': delta, // Note: This only updates changed fields
'updated_at': timestamp.toIso8601String(),
});
}