copyWith method

DirectMessage copyWith({
  1. int? id,
  2. String? textContent,
  3. String? deltaContent,
  4. int? group,
  5. String? fromUserFullName,
  6. int? fromUserId,
  7. dynamic replyTo,
  8. bool? isBase64Encoded,
  9. int? createdAt,
  10. dynamic updatedAt,
  11. dynamic forwardedByUser,
  12. dynamic forwardedFromGroup,
  13. List? seenBy,
  14. List<MessageFile>? files,
  15. List? replies,
  16. Reactions? reactions,
  17. int? hash,
  18. bool? isDeleted,
  19. bool? isPinned,
})

Implementation

DirectMessage copyWith({
  int? id,
  String? textContent,
  String? deltaContent,
  int? group,
  String? fromUserFullName,
  int? fromUserId,
  dynamic replyTo,
  bool? isBase64Encoded,
  int? createdAt,
  dynamic updatedAt,
  dynamic forwardedByUser,
  dynamic forwardedFromGroup,
  List<dynamic>? seenBy,
  List<MessageFile>? files,  // ✅ Changed type
  List<dynamic>? replies,
  Reactions? reactions,
  int? hash,
  bool? isDeleted,
  bool? isPinned,
}) {
  return DirectMessage(
    id: id ?? this.id,
    textContent: textContent ?? this.textContent,
    deltaContent: deltaContent ?? this.deltaContent,
    group: group ?? this.group,
    fromUserFullName: fromUserFullName ?? this.fromUserFullName,
    fromUserId: fromUserId ?? this.fromUserId,
    replyTo: replyTo ?? this.replyTo,
    isBase64Encoded: isBase64Encoded ?? this.isBase64Encoded,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    forwardedByUser: forwardedByUser ?? this.forwardedByUser,
    forwardedFromGroup: forwardedFromGroup ?? this.forwardedFromGroup,
    seenBy: seenBy ?? this.seenBy,
    files: files ?? this.files,
    replies: replies ?? this.replies,
    reactions: reactions ?? this.reactions,
    hash: hash ?? this.hash,
    isDeleted: isDeleted ?? this.isDeleted,
    isPinned: isPinned ?? this.isPinned,
  );
}