copyWith method

Message copyWith({
  1. int? id,
  2. MessageSender? senderId,
  3. int? chatId,
  4. MessageSendingState? sendingState()?,
  5. MessageSchedulingState? schedulingState()?,
  6. bool? isOutgoing,
  7. bool? isPinned,
  8. bool? canBeEdited,
  9. bool? canBeForwarded,
  10. bool? canBeRepliedInAnotherChat,
  11. bool? canBeSaved,
  12. bool? canBeDeletedOnlyForSelf,
  13. bool? canBeDeletedForAllUsers,
  14. bool? canGetAddedReactions,
  15. bool? canGetStatistics,
  16. bool? canGetMessageThread,
  17. bool? canGetReadDate,
  18. bool? canGetViewers,
  19. bool? canGetMediaTimestampLinks,
  20. bool? canReportReactions,
  21. bool? hasTimestampedMedia,
  22. bool? isChannelPost,
  23. bool? isTopicMessage,
  24. bool? containsUnreadMention,
  25. int? date,
  26. int? editDate,
  27. MessageForwardInfo? forwardInfo()?,
  28. MessageImportInfo? importInfo()?,
  29. MessageInteractionInfo? interactionInfo()?,
  30. List<UnreadReaction>? unreadReactions,
  31. MessageReplyTo? replyTo()?,
  32. int? messageThreadId,
  33. int? savedMessagesTopicId,
  34. MessageSelfDestructType? selfDestructType()?,
  35. double? selfDestructIn,
  36. double? autoDeleteIn,
  37. int? viaBotUserId,
  38. int? senderBoostCount,
  39. String? authorSignature,
  40. int? mediaAlbumId,
  41. String? restrictionReason,
  42. MessageContent? content,
  43. ReplyMarkup? replyMarkup()?,
  44. dynamic extra,
  45. int? clientId,
})

Returns a copy with the given fields replaced. For a nullable field pass a function, e.g. field: () => null to clear it.

Implementation

Message copyWith({
  int? id,
  MessageSender? senderId,
  int? chatId,
  MessageSendingState? Function()? sendingState,
  MessageSchedulingState? Function()? schedulingState,
  bool? isOutgoing,
  bool? isPinned,
  bool? canBeEdited,
  bool? canBeForwarded,
  bool? canBeRepliedInAnotherChat,
  bool? canBeSaved,
  bool? canBeDeletedOnlyForSelf,
  bool? canBeDeletedForAllUsers,
  bool? canGetAddedReactions,
  bool? canGetStatistics,
  bool? canGetMessageThread,
  bool? canGetReadDate,
  bool? canGetViewers,
  bool? canGetMediaTimestampLinks,
  bool? canReportReactions,
  bool? hasTimestampedMedia,
  bool? isChannelPost,
  bool? isTopicMessage,
  bool? containsUnreadMention,
  int? date,
  int? editDate,
  MessageForwardInfo? Function()? forwardInfo,
  MessageImportInfo? Function()? importInfo,
  MessageInteractionInfo? Function()? interactionInfo,
  List<UnreadReaction>? unreadReactions,
  MessageReplyTo? Function()? replyTo,
  int? messageThreadId,
  int? savedMessagesTopicId,
  MessageSelfDestructType? Function()? selfDestructType,
  double? selfDestructIn,
  double? autoDeleteIn,
  int? viaBotUserId,
  int? senderBoostCount,
  String? authorSignature,
  int? mediaAlbumId,
  String? restrictionReason,
  MessageContent? content,
  ReplyMarkup? Function()? replyMarkup,
  dynamic extra,
  int? clientId,
}) =>
    Message(
      id: id ?? this.id,
      senderId: senderId ?? this.senderId,
      chatId: chatId ?? this.chatId,
      sendingState: sendingState != null ? sendingState() : this.sendingState,
      schedulingState:
          schedulingState != null ? schedulingState() : this.schedulingState,
      isOutgoing: isOutgoing ?? this.isOutgoing,
      isPinned: isPinned ?? this.isPinned,
      canBeEdited: canBeEdited ?? this.canBeEdited,
      canBeForwarded: canBeForwarded ?? this.canBeForwarded,
      canBeRepliedInAnotherChat:
          canBeRepliedInAnotherChat ?? this.canBeRepliedInAnotherChat,
      canBeSaved: canBeSaved ?? this.canBeSaved,
      canBeDeletedOnlyForSelf:
          canBeDeletedOnlyForSelf ?? this.canBeDeletedOnlyForSelf,
      canBeDeletedForAllUsers:
          canBeDeletedForAllUsers ?? this.canBeDeletedForAllUsers,
      canGetAddedReactions: canGetAddedReactions ?? this.canGetAddedReactions,
      canGetStatistics: canGetStatistics ?? this.canGetStatistics,
      canGetMessageThread: canGetMessageThread ?? this.canGetMessageThread,
      canGetReadDate: canGetReadDate ?? this.canGetReadDate,
      canGetViewers: canGetViewers ?? this.canGetViewers,
      canGetMediaTimestampLinks:
          canGetMediaTimestampLinks ?? this.canGetMediaTimestampLinks,
      canReportReactions: canReportReactions ?? this.canReportReactions,
      hasTimestampedMedia: hasTimestampedMedia ?? this.hasTimestampedMedia,
      isChannelPost: isChannelPost ?? this.isChannelPost,
      isTopicMessage: isTopicMessage ?? this.isTopicMessage,
      containsUnreadMention:
          containsUnreadMention ?? this.containsUnreadMention,
      date: date ?? this.date,
      editDate: editDate ?? this.editDate,
      forwardInfo: forwardInfo != null ? forwardInfo() : this.forwardInfo,
      importInfo: importInfo != null ? importInfo() : this.importInfo,
      interactionInfo:
          interactionInfo != null ? interactionInfo() : this.interactionInfo,
      unreadReactions: unreadReactions ?? this.unreadReactions,
      replyTo: replyTo != null ? replyTo() : this.replyTo,
      messageThreadId: messageThreadId ?? this.messageThreadId,
      savedMessagesTopicId: savedMessagesTopicId ?? this.savedMessagesTopicId,
      selfDestructType: selfDestructType != null
          ? selfDestructType()
          : this.selfDestructType,
      selfDestructIn: selfDestructIn ?? this.selfDestructIn,
      autoDeleteIn: autoDeleteIn ?? this.autoDeleteIn,
      viaBotUserId: viaBotUserId ?? this.viaBotUserId,
      senderBoostCount: senderBoostCount ?? this.senderBoostCount,
      authorSignature: authorSignature ?? this.authorSignature,
      mediaAlbumId: mediaAlbumId ?? this.mediaAlbumId,
      restrictionReason: restrictionReason ?? this.restrictionReason,
      content: content ?? this.content,
      replyMarkup: replyMarkup != null ? replyMarkup() : this.replyMarkup,
      extra: extra ?? this.extra,
      clientId: clientId ?? this.clientId,
    );