copyWith method
User
copyWith({
- int? id,
- String? firstName,
- String? lastName,
- Usernames? usernames()?,
- String? phoneNumber,
- UserStatus? status,
- ProfilePhoto? profilePhoto()?,
- int? accentColorId,
- int? backgroundCustomEmojiId,
- int? profileAccentColorId,
- int? profileBackgroundCustomEmojiId,
- EmojiStatus? 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,
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,
);