@@ -24,6 +24,10 @@ class SyncStatus {
24
24
/// Currently this is reset to null after a restart.
25
25
final DateTime ? lastSyncedAt;
26
26
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
+
27
31
/// Error during uploading.
28
32
///
29
33
/// Cleared on the next successful upload.
@@ -38,6 +42,7 @@ class SyncStatus {
38
42
{this .connected = false ,
39
43
this .connecting = false ,
40
44
this .lastSyncedAt,
45
+ this .hasSynced,
41
46
this .downloading = false ,
42
47
this .uploading = false ,
43
48
this .downloadError,
@@ -52,7 +57,30 @@ class SyncStatus {
52
57
other.connecting == connecting &&
53
58
other.downloadError == downloadError &&
54
59
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
+ );
56
84
}
57
85
58
86
/// Get the current [downloadError] or [uploadError] .
@@ -68,7 +96,7 @@ class SyncStatus {
68
96
69
97
@override
70
98
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 >" ;
72
100
}
73
101
}
74
102
0 commit comments