User.deserialize constructor
User.deserialize(
- BinaryReader reader
Deserialize.
Implementation
factory User.deserialize(BinaryReader reader) {
// Read [User] fields.
final flags = reader.readInt32();
final self = (flags & 1024) != 0;
final contact = (flags & 2048) != 0;
final mutualContact = (flags & 4096) != 0;
final deleted = (flags & 8192) != 0;
final bot = (flags & 16384) != 0;
final botChatHistory = (flags & 32768) != 0;
final botNochats = (flags & 65536) != 0;
final verified = (flags & 131072) != 0;
final restricted = (flags & 262144) != 0;
final min = (flags & 1048576) != 0;
final botInlineGeo = (flags & 2097152) != 0;
final support = (flags & 8388608) != 0;
final scam = (flags & 16777216) != 0;
final applyMinPhoto = (flags & 33554432) != 0;
final fake = (flags & 67108864) != 0;
final botAttachMenu = (flags & 134217728) != 0;
final premium = (flags & 268435456) != 0;
final attachMenuEnabled = (flags & 536870912) != 0;
final flags2 = reader.readInt32();
final botCanEdit = (flags2 & 2) != 0;
final closeFriend = (flags2 & 4) != 0;
final storiesHidden = (flags2 & 8) != 0;
final storiesUnavailable = (flags2 & 16) != 0;
final id = reader.readInt64();
final hasAccessHashField = (flags & 1) != 0;
final accessHash = hasAccessHashField ? reader.readInt64() : null;
final hasFirstNameField = (flags & 2) != 0;
final firstName = hasFirstNameField ? reader.readString() : null;
final hasLastNameField = (flags & 4) != 0;
final lastName = hasLastNameField ? reader.readString() : null;
final hasUsernameField = (flags & 8) != 0;
final username = hasUsernameField ? reader.readString() : null;
final hasPhoneField = (flags & 16) != 0;
final phone = hasPhoneField ? reader.readString() : null;
final hasPhotoField = (flags & 32) != 0;
final photo =
hasPhotoField ? reader.readObject() as UserProfilePhotoBase : null;
final hasStatusField = (flags & 64) != 0;
final status =
hasStatusField ? reader.readObject() as UserStatusBase : null;
final hasBotInfoVersionField = (flags & 16384) != 0;
final botInfoVersion = hasBotInfoVersionField ? reader.readInt32() : null;
final hasRestrictionReasonField = (flags & 262144) != 0;
final restrictionReason = hasRestrictionReasonField
? reader.readVectorObject<RestrictionReasonBase>()
: null;
final hasBotInlinePlaceholderField = (flags & 524288) != 0;
final botInlinePlaceholder =
hasBotInlinePlaceholderField ? reader.readString() : null;
final hasLangCodeField = (flags & 4194304) != 0;
final langCode = hasLangCodeField ? reader.readString() : null;
final hasEmojiStatusField = (flags & 1073741824) != 0;
final emojiStatus =
hasEmojiStatusField ? reader.readObject() as EmojiStatusBase : null;
final hasUsernamesField = (flags2 & 1) != 0;
final usernames =
hasUsernamesField ? reader.readVectorObject<UsernameBase>() : null;
final hasStoriesMaxIdField = (flags2 & 32) != 0;
final storiesMaxId = hasStoriesMaxIdField ? reader.readInt32() : null;
final hasColorField = (flags2 & 256) != 0;
final color = hasColorField ? reader.readObject() as PeerColorBase : null;
final hasProfileColorField = (flags2 & 512) != 0;
final profileColor =
hasProfileColorField ? reader.readObject() as PeerColorBase : null;
// Construct [User] object.
final returnValue = User(
self: self,
contact: contact,
mutualContact: mutualContact,
deleted: deleted,
bot: bot,
botChatHistory: botChatHistory,
botNochats: botNochats,
verified: verified,
restricted: restricted,
min: min,
botInlineGeo: botInlineGeo,
support: support,
scam: scam,
applyMinPhoto: applyMinPhoto,
fake: fake,
botAttachMenu: botAttachMenu,
premium: premium,
attachMenuEnabled: attachMenuEnabled,
botCanEdit: botCanEdit,
closeFriend: closeFriend,
storiesHidden: storiesHidden,
storiesUnavailable: storiesUnavailable,
id: id,
accessHash: accessHash,
firstName: firstName,
lastName: lastName,
username: username,
phone: phone,
photo: photo,
status: status,
botInfoVersion: botInfoVersion,
restrictionReason: restrictionReason,
botInlinePlaceholder: botInlinePlaceholder,
langCode: langCode,
emojiStatus: emojiStatus,
usernames: usernames,
storiesMaxId: storiesMaxId,
color: color,
profileColor: profileColor,
);
// Now return the deserialized [User].
return returnValue;
}