DocumentDelta class
Represents a partial update (delta) to a document.
Delta sync only sends changed fields instead of the entire document, reducing bandwidth usage by up to 98% for large documents.
Example:
// Instead of sending entire document:
await collection.save({
'id': '123',
'title': 'My Document',
'content': '... 50KB of content ...',
'metadata': {...},
'done': true, // Only this changed
});
// Send only the changed field:
await collection.update('123', {'done': true});
Constructors
-
DocumentDelta({required String recordId, required String collectionName, required Map<
String, dynamic> changedFields, required DateTime timestamp, required int baseVersion}) -
const
-
DocumentDelta.fromJson(Map<
String, dynamic> json) -
Create from JSON
factory
Properties
- baseVersion → int
-
Version of the document before this delta
final
-
changedFields
→ Map<
String, dynamic> -
Only the fields that changed
final
- collectionName → String
-
The collection name
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- recordId → String
-
The document ID being updated
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timestamp → DateTime
-
Timestamp of the update
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Convert to JSON for network transmission
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited