27 lines
773 B
Dart
27 lines
773 B
Dart
/// Result of a profile sync attempt.
|
|
enum SyncResultKind { success, offline, conflictResolved, error }
|
|
|
|
class SyncResult {
|
|
const SyncResult._(this.kind, {this.message});
|
|
|
|
const SyncResult.success() : this._(SyncResultKind.success);
|
|
|
|
const SyncResult.offline() : this._(SyncResultKind.offline);
|
|
|
|
const SyncResult.conflictResolved()
|
|
: this._(SyncResultKind.conflictResolved);
|
|
|
|
const SyncResult.error(String message)
|
|
: this._(SyncResultKind.error, message: message);
|
|
|
|
final SyncResultKind kind;
|
|
final String? message;
|
|
|
|
bool get isSuccess =>
|
|
kind == SyncResultKind.success ||
|
|
kind == SyncResultKind.conflictResolved;
|
|
}
|
|
|
|
/// UI-facing sync state from [UserProfileRepository].
|
|
enum ProfileSyncStatus { idle, syncing, synced, offline, error }
|