toMap method
Converts to a map.
Implementation
Map<String, dynamic> toMap() => {
'userId': userId,
if (lastSyncTime != null) 'lastSyncTime': lastSyncTime!.toUtc().toIso8601String(),
if (lastSuccessfulSyncTime != null) 'lastSuccessfulSyncTime': lastSuccessfulSyncTime!.toUtc().toIso8601String(),
if (dataHash != null) 'dataHash': dataHash,
if (deviceId != null) 'deviceId': deviceId,
if (devices != null)
'devices': devices!.map(
(key, value) => MapEntry(key, value.toUtc().toIso8601String()),
),
if (customMetadata != null) 'customMetadata': customMetadata,
if (entityCounts != null)
'entityCounts': entityCounts!.map(
(key, value) => MapEntry(key, value.toMap()),
),
'syncStatus': syncStatus.toString().split('.').last,
'syncVersion': syncVersion,
if (serverTimestamp != null) 'serverTimestamp': serverTimestamp!.toUtc().toIso8601String(),
'conflictCount': conflictCount,
if (errorMessage != null) 'errorMessage': errorMessage,
'retryCount': retryCount,
if (syncDuration != null) 'syncDuration': syncDuration,
};