ContactsSyncState class

The whole synced contacts document for one owner identity.

Constructors

ContactsSyncState({required String ownerAddress, required Map<String, ContactSyncEntry> entries, required int lastUpdated, bool isSynced = false, Map<String, dynamic>? unknownFields})
ContactsSyncState.empty(String ownerAddress)
Empty state for a fresh install. Uses lastUpdated: 0 so any real remote document wins on first sync (the epoch-0 placeholder pattern).
factory
ContactsSyncState.fromJson(Map<String, dynamic> json)
factory

Properties

entries → Map<String, ContactSyncEntry>
Contacts keyed by address.
final
hashCode → int
The hash code for this object.
no setteroverride
isSynced → bool
Local-only flag: whether the local state matches the pod. Never sent to the pod (omitted when includeLocalFields is false).
final
lastUpdated → int
Coarse document timestamp (Unix ms), a cheap "is remote newer at all?" pre-check before the real per-entry merge. Bumped on every local change.
final
liveEntries → Iterable<ContactSyncEntry>
Only the entries that should be shown/used (a contact, or holding a retained fiche/folder). Dead entries are hidden but kept for propagation.
no setter
ownerAddress → String
Address of the identity whose pod hosts this document.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
unknownFields → Map<String, dynamic>
Forward-compatibility: document-level fields written by a newer client that this version does not recognise. Captured and re-emitted like ContactSyncEntry.unknownFields.
final

Methods

copyWith({Map<String, ContactSyncEntry>? entries, int? lastUpdated, bool? isSynced, Map<String, dynamic>? unknownFields}) → ContactsSyncState
garbageCollected({required int nowMs, int maxAgeMs = kContactsSyncGcMaxAgeMs}) → ContactsSyncState
Drop dead entries whose newest field is older than maxAgeMs relative to nowMs. Keeps recent removals around long enough to propagate.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson({bool includeLocalFields = true}) → Map<String, dynamic>
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override

Static Methods

merge(ContactsSyncState a, ContactsSyncState b) → ContactsSyncState
Union merge of two states: every address from either side, per-entry per-field LWW. The result's lastUpdated is the max of both.