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. int? profileAccentColorId,
  11. int? profileBackgroundCustomEmojiId,
  12. EmojiStatus? emojiStatus()?,
  13. bool? isContact,
  14. bool? isMutualContact,
  15. bool? isCloseFriend,
  16. bool? isVerified,
  17. bool? isPremium,
  18. bool? isSupport,
  19. String? restrictionReason,
  20. bool? isScam,
  21. bool? isFake,
  22. bool? hasActiveStories,
  23. bool? hasUnreadActiveStories,
  24. bool? restrictsNewChats,
  25. bool? haveAccess,
  26. UserType? type,
  27. String? languageCode,
  28. bool? addedToAttachmentMenu,
  29. dynamic extra,
  30. 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,
  int? profileAccentColorId,
  int? profileBackgroundCustomEmojiId,
  EmojiStatus? Function()? emojiStatus,
  bool? isContact,
  bool? isMutualContact,
  bool? isCloseFriend,
  bool? isVerified,
  bool? isPremium,
  bool? isSupport,
  String? restrictionReason,
  bool? isScam,
  bool? isFake,
  bool? hasActiveStories,
  bool? hasUnreadActiveStories,
  bool? restrictsNewChats,
  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,
      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,
      isVerified: isVerified ?? this.isVerified,
      isPremium: isPremium ?? this.isPremium,
      isSupport: isSupport ?? this.isSupport,
      restrictionReason: restrictionReason ?? this.restrictionReason,
      isScam: isScam ?? this.isScam,
      isFake: isFake ?? this.isFake,
      hasActiveStories: hasActiveStories ?? this.hasActiveStories,
      hasUnreadActiveStories:
          hasUnreadActiveStories ?? this.hasUnreadActiveStories,
      restrictsNewChats: restrictsNewChats ?? this.restrictsNewChats,
      haveAccess: haveAccess ?? this.haveAccess,
      type: type ?? this.type,
      languageCode: languageCode ?? this.languageCode,
      addedToAttachmentMenu:
          addedToAttachmentMenu ?? this.addedToAttachmentMenu,
      extra: extra ?? this.extra,
      clientId: clientId ?? this.clientId,
    );