UserFull.deserialize constructor

UserFull.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory UserFull.deserialize(BinaryReader reader) {
  // Read [UserFull] fields.
  final flags = reader.readInt32();
  final blocked = (flags & 1) != 0;
  final phoneCallsAvailable = (flags & 16) != 0;
  final phoneCallsPrivate = (flags & 32) != 0;
  final canPinMessage = (flags & 128) != 0;
  final hasScheduled = (flags & 4096) != 0;
  final videoCallsAvailable = (flags & 8192) != 0;
  final voiceMessagesForbidden = (flags & 1048576) != 0;
  final translationsDisabled = (flags & 8388608) != 0;
  final storiesPinnedAvailable = (flags & 67108864) != 0;
  final blockedMyStoriesFrom = (flags & 134217728) != 0;
  final wallpaperOverridden = (flags & 268435456) != 0;
  final id = reader.readInt64();
  final hasAboutField = (flags & 2) != 0;
  final about = hasAboutField ? reader.readString() : null;
  final settings = reader.readObject() as PeerSettingsBase;
  final hasPersonalPhotoField = (flags & 2097152) != 0;
  final personalPhoto =
      hasPersonalPhotoField ? reader.readObject() as PhotoBase : null;
  final hasProfilePhotoField = (flags & 4) != 0;
  final profilePhoto =
      hasProfilePhotoField ? reader.readObject() as PhotoBase : null;
  final hasFallbackPhotoField = (flags & 4194304) != 0;
  final fallbackPhoto =
      hasFallbackPhotoField ? reader.readObject() as PhotoBase : null;
  final notifySettings = reader.readObject() as PeerNotifySettingsBase;
  final hasBotInfoField = (flags & 8) != 0;
  final botInfo = hasBotInfoField ? reader.readObject() as BotInfoBase : null;
  final hasPinnedMsgIdField = (flags & 64) != 0;
  final pinnedMsgId = hasPinnedMsgIdField ? reader.readInt32() : null;
  final commonChatsCount = reader.readInt32();
  final hasFolderIdField = (flags & 2048) != 0;
  final folderId = hasFolderIdField ? reader.readInt32() : null;
  final hasTtlPeriodField = (flags & 16384) != 0;
  final ttlPeriod = hasTtlPeriodField ? reader.readInt32() : null;
  final hasThemeEmoticonField = (flags & 32768) != 0;
  final themeEmoticon = hasThemeEmoticonField ? reader.readString() : null;
  final hasPrivateForwardNameField = (flags & 65536) != 0;
  final privateForwardName =
      hasPrivateForwardNameField ? reader.readString() : null;
  final hasBotGroupAdminRightsField = (flags & 131072) != 0;
  final botGroupAdminRights = hasBotGroupAdminRightsField
      ? reader.readObject() as ChatAdminRightsBase
      : null;
  final hasBotBroadcastAdminRightsField = (flags & 262144) != 0;
  final botBroadcastAdminRights = hasBotBroadcastAdminRightsField
      ? reader.readObject() as ChatAdminRightsBase
      : null;
  final hasPremiumGiftsField = (flags & 524288) != 0;
  final premiumGifts = hasPremiumGiftsField
      ? reader.readVectorObject<PremiumGiftOptionBase>()
      : null;
  final hasWallpaperField = (flags & 16777216) != 0;
  final wallpaper =
      hasWallpaperField ? reader.readObject() as WallPaperBase : null;
  final hasStoriesField = (flags & 33554432) != 0;
  final stories =
      hasStoriesField ? reader.readObject() as PeerStoriesBase : null;

  // Construct [UserFull] object.
  final returnValue = UserFull(
    blocked: blocked,
    phoneCallsAvailable: phoneCallsAvailable,
    phoneCallsPrivate: phoneCallsPrivate,
    canPinMessage: canPinMessage,
    hasScheduled: hasScheduled,
    videoCallsAvailable: videoCallsAvailable,
    voiceMessagesForbidden: voiceMessagesForbidden,
    translationsDisabled: translationsDisabled,
    storiesPinnedAvailable: storiesPinnedAvailable,
    blockedMyStoriesFrom: blockedMyStoriesFrom,
    wallpaperOverridden: wallpaperOverridden,
    id: id,
    about: about,
    settings: settings,
    personalPhoto: personalPhoto,
    profilePhoto: profilePhoto,
    fallbackPhoto: fallbackPhoto,
    notifySettings: notifySettings,
    botInfo: botInfo,
    pinnedMsgId: pinnedMsgId,
    commonChatsCount: commonChatsCount,
    folderId: folderId,
    ttlPeriod: ttlPeriod,
    themeEmoticon: themeEmoticon,
    privateForwardName: privateForwardName,
    botGroupAdminRights: botGroupAdminRights,
    botBroadcastAdminRights: botBroadcastAdminRights,
    premiumGifts: premiumGifts,
    wallpaper: wallpaper,
    stories: stories,
  );

  // Now return the deserialized [UserFull].
  return returnValue;
}