@@ -24,6 +24,10 @@ class SyncStatus {
2424 /// Currently this is reset to null after a restart.
2525 final DateTime ? lastSyncedAt;
2626
27+ /// Indicates whether there has been at least one full sync, if any.
28+ /// Is null when unknown, for example when state is still being loaded from the database.
29+ final bool ? hasSynced;
30+
2731 /// Error during uploading.
2832 ///
2933 /// Cleared on the next successful upload.
@@ -38,6 +42,7 @@ class SyncStatus {
3842 {this .connected = false ,
3943 this .connecting = false ,
4044 this .lastSyncedAt,
45+ this .hasSynced,
4146 this .downloading = false ,
4247 this .uploading = false ,
4348 this .downloadError,
@@ -52,7 +57,30 @@ class SyncStatus {
5257 other.connecting == connecting &&
5358 other.downloadError == downloadError &&
5459 other.uploadError == uploadError &&
55- other.lastSyncedAt == lastSyncedAt);
60+ other.lastSyncedAt == lastSyncedAt &&
61+ other.hasSynced == hasSynced);
62+ }
63+
64+ SyncStatus copyWith ({
65+ bool ? connected,
66+ bool ? downloading,
67+ bool ? uploading,
68+ bool ? connecting,
69+ Object ? uploadError,
70+ Object ? downloadError,
71+ DateTime ? lastSyncedAt,
72+ bool ? hasSynced,
73+ }) {
74+ return SyncStatus (
75+ connected: connected ?? this .connected,
76+ downloading: downloading ?? this .downloading,
77+ uploading: uploading ?? this .uploading,
78+ connecting: connecting ?? this .connecting,
79+ uploadError: uploadError ?? this .uploadError,
80+ downloadError: downloadError ?? this .downloadError,
81+ lastSyncedAt: lastSyncedAt ?? this .lastSyncedAt,
82+ hasSynced: hasSynced ?? this .hasSynced,
83+ );
5684 }
5785
5886 /// Get the current [downloadError] or [uploadError] .
@@ -68,7 +96,7 @@ class SyncStatus {
6896
6997 @override
7098 String toString () {
71- return "SyncStatus<connected: $connected connecting: $connecting downloading: $downloading uploading: $uploading lastSyncedAt: $lastSyncedAt error: $anyError >" ;
99+ return "SyncStatus<connected: $connected connecting: $connecting downloading: $downloading uploading: $uploading lastSyncedAt: $lastSyncedAt , hasSynced: $ hasSynced , error: $anyError >" ;
72100 }
73101}
74102
0 commit comments