copyWith method

CloudSyncable copyWith({
  1. String? id,
  2. DateTime? createdAt,
  3. DateTime? updatedAt,
  4. DateTime? localTimeSyncedAt,
  5. DateTime? serverTimeSyncedAt,
  6. DateTime? deletedAt,
  7. String? localFilePath,
  8. String? remoteFilePath,
  9. DateTime? fileSyncedAt,
  10. String? timeOffset,
})

Creates a copy of this object with the given fields replaced with the new values.

Implementation

CloudSyncable copyWith({
  String? id,
  DateTime? createdAt,
  DateTime? updatedAt,
  DateTime? localTimeSyncedAt,
  DateTime? serverTimeSyncedAt,
  DateTime? deletedAt,
  String? localFilePath,
  String? remoteFilePath,
  DateTime? fileSyncedAt,
  String? timeOffset,
}) {
  return CloudSyncable(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    localTimeSyncedAt: localTimeSyncedAt ?? this.localTimeSyncedAt,
    serverTimeSyncedAt: serverTimeSyncedAt ?? this.serverTimeSyncedAt,
    deletedAt: deletedAt ?? this.deletedAt,
    localFilePath: localFilePath ?? this.localFilePath,
    remoteFilePath: remoteFilePath ?? this.remoteFilePath,
    fileSyncedAt: fileSyncedAt ?? this.fileSyncedAt,
    timeOffset: timeOffset ??
        this.timeOffset, // Only update if a new value is provided
  );
}