copyWith method

User copyWith({
  1. int? id,
  2. String? firstName,
  3. String? lastName,
  4. Usernames? usernames()?,
  5. String? phoneNumber,
  6. UserStatus? status,
  7. ProfilePhoto? profilePhoto()?,
  8. int? accentColorId,
  9. int? backgroundCustomEmojiId,
  10. UpgradedGiftColors? upgradedGiftColors()?,
  11. int? profileAccentColorId,
  12. int? profileBackgroundCustomEmojiId,
  13. EmojiStatus? emojiStatus()?,
  14. bool? isContact,
  15. bool? isMutualContact,
  16. bool? isCloseFriend,
  17. VerificationStatus? verificationStatus()?,
  18. bool? isPremium,
  19. bool? isSupport,
  20. RestrictionInfo? restrictionInfo()?,
  21. ActiveStoryState? activeStoryState()?,
  22. bool? restrictsNewChats,
  23. int? paidMessageStarCount,
  24. bool? haveAccess,
  25. UserType? type,
  26. String? languageCode,
  27. bool? addedToAttachmentMenu,
  28. dynamic extra,
  29. 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

User copyWith({
  int? id,
  String? firstName,
  String? lastName,
  Usernames? Function()? usernames,
  String? phoneNumber,
  UserStatus? status,
  ProfilePhoto? Function()? profilePhoto,
  int? accentColorId,
  int? backgroundCustomEmojiId,
  UpgradedGiftColors? Function()? upgradedGiftColors,
  int? profileAccentColorId,
  int? profileBackgroundCustomEmojiId,
  EmojiStatus? Function()? emojiStatus,
  bool? isContact,
  bool? isMutualContact,
  bool? isCloseFriend,
  VerificationStatus? Function()? verificationStatus,
  bool? isPremium,
  bool? isSupport,
  RestrictionInfo? Function()? restrictionInfo,
  ActiveStoryState? Function()? activeStoryState,
  bool? restrictsNewChats,
  int? paidMessageStarCount,
  bool? haveAccess,
  UserType? type,
  String? languageCode,
  bool? addedToAttachmentMenu,
  dynamic extra,
  int? clientId,
}) => User(
  id: id ?? this.id,
  firstName: firstName ?? this.firstName,
  lastName: lastName ?? this.lastName,
  usernames: usernames != null ? usernames() : this.usernames,
  phoneNumber: phoneNumber ?? this.phoneNumber,
  status: status ?? this.status,
  profilePhoto: profilePhoto != null ? profilePhoto() : this.profilePhoto,
  accentColorId: accentColorId ?? this.accentColorId,
  backgroundCustomEmojiId:
      backgroundCustomEmojiId ?? this.backgroundCustomEmojiId,
  upgradedGiftColors: upgradedGiftColors != null
      ? upgradedGiftColors()
      : this.upgradedGiftColors,
  profileAccentColorId: profileAccentColorId ?? this.profileAccentColorId,
  profileBackgroundCustomEmojiId:
      profileBackgroundCustomEmojiId ?? this.profileBackgroundCustomEmojiId,
  emojiStatus: emojiStatus != null ? emojiStatus() : this.emojiStatus,
  isContact: isContact ?? this.isContact,
  isMutualContact: isMutualContact ?? this.isMutualContact,
  isCloseFriend: isCloseFriend ?? this.isCloseFriend,
  verificationStatus: verificationStatus != null
      ? verificationStatus()
      : this.verificationStatus,
  isPremium: isPremium ?? this.isPremium,
  isSupport: isSupport ?? this.isSupport,
  restrictionInfo: restrictionInfo != null
      ? restrictionInfo()
      : this.restrictionInfo,
  activeStoryState: activeStoryState != null
      ? activeStoryState()
      : this.activeStoryState,
  restrictsNewChats: restrictsNewChats ?? this.restrictsNewChats,
  paidMessageStarCount: paidMessageStarCount ?? this.paidMessageStarCount,
  haveAccess: haveAccess ?? this.haveAccess,
  type: type ?? this.type,
  languageCode: languageCode ?? this.languageCode,
  addedToAttachmentMenu: addedToAttachmentMenu ?? this.addedToAttachmentMenu,
  extra: extra ?? this.extra,
  clientId: clientId ?? this.clientId,
);