copyWith method

Chat copyWith({
  1. int? id,
  2. ChatType? type,
  3. String? title,
  4. ChatPhotoInfo? photo()?,
  5. int? accentColorId,
  6. int? backgroundCustomEmojiId,
  7. int? profileAccentColorId,
  8. int? profileBackgroundCustomEmojiId,
  9. ChatPermissions? permissions,
  10. Message? lastMessage()?,
  11. List<ChatPosition>? positions,
  12. List<ChatList>? chatLists,
  13. MessageSender? messageSenderId()?,
  14. BlockList? blockList()?,
  15. bool? hasProtectedContent,
  16. bool? isTranslatable,
  17. bool? isMarkedAsUnread,
  18. bool? viewAsTopics,
  19. bool? hasScheduledMessages,
  20. bool? canBeDeletedOnlyForSelf,
  21. bool? canBeDeletedForAllUsers,
  22. bool? canBeReported,
  23. bool? defaultDisableNotification,
  24. int? unreadCount,
  25. int? lastReadInboxMessageId,
  26. int? lastReadOutboxMessageId,
  27. int? unreadMentionCount,
  28. int? unreadReactionCount,
  29. ChatNotificationSettings? notificationSettings,
  30. ChatAvailableReactions? availableReactions,
  31. int? messageAutoDeleteTime,
  32. EmojiStatus? emojiStatus()?,
  33. ChatBackground? background()?,
  34. String? themeName,
  35. ChatActionBar? actionBar()?,
  36. VideoChat? videoChat,
  37. ChatJoinRequestsInfo? pendingJoinRequests()?,
  38. int? replyMarkupMessageId,
  39. DraftMessage? draftMessage()?,
  40. String? clientData,
  41. dynamic extra,
  42. 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

Chat copyWith({
  int? id,
  ChatType? type,
  String? title,
  ChatPhotoInfo? Function()? photo,
  int? accentColorId,
  int? backgroundCustomEmojiId,
  int? profileAccentColorId,
  int? profileBackgroundCustomEmojiId,
  ChatPermissions? permissions,
  Message? Function()? lastMessage,
  List<ChatPosition>? positions,
  List<ChatList>? chatLists,
  MessageSender? Function()? messageSenderId,
  BlockList? Function()? blockList,
  bool? hasProtectedContent,
  bool? isTranslatable,
  bool? isMarkedAsUnread,
  bool? viewAsTopics,
  bool? hasScheduledMessages,
  bool? canBeDeletedOnlyForSelf,
  bool? canBeDeletedForAllUsers,
  bool? canBeReported,
  bool? defaultDisableNotification,
  int? unreadCount,
  int? lastReadInboxMessageId,
  int? lastReadOutboxMessageId,
  int? unreadMentionCount,
  int? unreadReactionCount,
  ChatNotificationSettings? notificationSettings,
  ChatAvailableReactions? availableReactions,
  int? messageAutoDeleteTime,
  EmojiStatus? Function()? emojiStatus,
  ChatBackground? Function()? background,
  String? themeName,
  ChatActionBar? Function()? actionBar,
  VideoChat? videoChat,
  ChatJoinRequestsInfo? Function()? pendingJoinRequests,
  int? replyMarkupMessageId,
  DraftMessage? Function()? draftMessage,
  String? clientData,
  dynamic extra,
  int? clientId,
}) =>
    Chat(
      id: id ?? this.id,
      type: type ?? this.type,
      title: title ?? this.title,
      photo: photo != null ? photo() : this.photo,
      accentColorId: accentColorId ?? this.accentColorId,
      backgroundCustomEmojiId:
          backgroundCustomEmojiId ?? this.backgroundCustomEmojiId,
      profileAccentColorId: profileAccentColorId ?? this.profileAccentColorId,
      profileBackgroundCustomEmojiId: profileBackgroundCustomEmojiId ??
          this.profileBackgroundCustomEmojiId,
      permissions: permissions ?? this.permissions,
      lastMessage: lastMessage != null ? lastMessage() : this.lastMessage,
      positions: positions ?? this.positions,
      chatLists: chatLists ?? this.chatLists,
      messageSenderId:
          messageSenderId != null ? messageSenderId() : this.messageSenderId,
      blockList: blockList != null ? blockList() : this.blockList,
      hasProtectedContent: hasProtectedContent ?? this.hasProtectedContent,
      isTranslatable: isTranslatable ?? this.isTranslatable,
      isMarkedAsUnread: isMarkedAsUnread ?? this.isMarkedAsUnread,
      viewAsTopics: viewAsTopics ?? this.viewAsTopics,
      hasScheduledMessages: hasScheduledMessages ?? this.hasScheduledMessages,
      canBeDeletedOnlyForSelf:
          canBeDeletedOnlyForSelf ?? this.canBeDeletedOnlyForSelf,
      canBeDeletedForAllUsers:
          canBeDeletedForAllUsers ?? this.canBeDeletedForAllUsers,
      canBeReported: canBeReported ?? this.canBeReported,
      defaultDisableNotification:
          defaultDisableNotification ?? this.defaultDisableNotification,
      unreadCount: unreadCount ?? this.unreadCount,
      lastReadInboxMessageId:
          lastReadInboxMessageId ?? this.lastReadInboxMessageId,
      lastReadOutboxMessageId:
          lastReadOutboxMessageId ?? this.lastReadOutboxMessageId,
      unreadMentionCount: unreadMentionCount ?? this.unreadMentionCount,
      unreadReactionCount: unreadReactionCount ?? this.unreadReactionCount,
      notificationSettings: notificationSettings ?? this.notificationSettings,
      availableReactions: availableReactions ?? this.availableReactions,
      messageAutoDeleteTime:
          messageAutoDeleteTime ?? this.messageAutoDeleteTime,
      emojiStatus: emojiStatus != null ? emojiStatus() : this.emojiStatus,
      background: background != null ? background() : this.background,
      themeName: themeName ?? this.themeName,
      actionBar: actionBar != null ? actionBar() : this.actionBar,
      videoChat: videoChat ?? this.videoChat,
      pendingJoinRequests: pendingJoinRequests != null
          ? pendingJoinRequests()
          : this.pendingJoinRequests,
      replyMarkupMessageId: replyMarkupMessageId ?? this.replyMarkupMessageId,
      draftMessage: draftMessage != null ? draftMessage() : this.draftMessage,
      clientData: clientData ?? this.clientData,
      extra: extra ?? this.extra,
      clientId: clientId ?? this.clientId,
    );