ChannelFull.deserialize constructor

ChannelFull.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory ChannelFull.deserialize(BinaryReader reader) {
  // Read [ChannelFull] fields.
  final flags = reader.readInt32();
  final canViewParticipants = (flags & 8) != 0;
  final canSetUsername = (flags & 64) != 0;
  final canSetStickers = (flags & 128) != 0;
  final hiddenPrehistory = (flags & 1024) != 0;
  final canSetLocation = (flags & 65536) != 0;
  final hasScheduled = (flags & 524288) != 0;
  final canViewStats = (flags & 1048576) != 0;
  final blocked = (flags & 4194304) != 0;
  final flags2 = reader.readInt32();
  final canDeleteChannel = (flags2 & 1) != 0;
  final antispam = (flags2 & 2) != 0;
  final participantsHidden = (flags2 & 4) != 0;
  final translationsDisabled = (flags2 & 8) != 0;
  final storiesPinnedAvailable = (flags2 & 32) != 0;
  final viewForumAsMessages = (flags2 & 64) != 0;
  final id = reader.readInt64();
  final about = reader.readString();
  final hasParticipantsCountField = (flags & 1) != 0;
  final participantsCount =
      hasParticipantsCountField ? reader.readInt32() : null;
  final hasAdminsCountField = (flags & 2) != 0;
  final adminsCount = hasAdminsCountField ? reader.readInt32() : null;
  final hasKickedCountField = (flags & 4) != 0;
  final kickedCount = hasKickedCountField ? reader.readInt32() : null;
  final hasBannedCountField = (flags & 4) != 0;
  final bannedCount = hasBannedCountField ? reader.readInt32() : null;
  final hasOnlineCountField = (flags & 8192) != 0;
  final onlineCount = hasOnlineCountField ? reader.readInt32() : null;
  final readInboxMaxId = reader.readInt32();
  final readOutboxMaxId = reader.readInt32();
  final unreadCount = reader.readInt32();
  final chatPhoto = reader.readObject() as PhotoBase;
  final notifySettings = reader.readObject() as PeerNotifySettingsBase;
  final hasExportedInviteField = (flags & 8388608) != 0;
  final exportedInvite = hasExportedInviteField
      ? reader.readObject() as ExportedChatInviteBase
      : null;
  final botInfo = reader.readVectorObject<BotInfoBase>();
  final hasMigratedFromChatIdField = (flags & 16) != 0;
  final migratedFromChatId =
      hasMigratedFromChatIdField ? reader.readInt64() : null;
  final hasMigratedFromMaxIdField = (flags & 16) != 0;
  final migratedFromMaxId =
      hasMigratedFromMaxIdField ? reader.readInt32() : null;
  final hasPinnedMsgIdField = (flags & 32) != 0;
  final pinnedMsgId = hasPinnedMsgIdField ? reader.readInt32() : null;
  final hasStickersetField = (flags & 256) != 0;
  final stickerset =
      hasStickersetField ? reader.readObject() as StickerSetBase : null;
  final hasAvailableMinIdField = (flags & 512) != 0;
  final availableMinId = hasAvailableMinIdField ? reader.readInt32() : null;
  final hasFolderIdField = (flags & 2048) != 0;
  final folderId = hasFolderIdField ? reader.readInt32() : null;
  final hasLinkedChatIdField = (flags & 16384) != 0;
  final linkedChatId = hasLinkedChatIdField ? reader.readInt64() : null;
  final hasLocationField = (flags & 32768) != 0;
  final location =
      hasLocationField ? reader.readObject() as ChannelLocationBase : null;
  final hasSlowmodeSecondsField = (flags & 131072) != 0;
  final slowmodeSeconds = hasSlowmodeSecondsField ? reader.readInt32() : null;
  final hasSlowmodeNextSendDateField = (flags & 262144) != 0;
  final slowmodeNextSendDate =
      hasSlowmodeNextSendDateField ? reader.readDateTime() : null;
  final hasStatsDcField = (flags & 4096) != 0;
  final statsDc = hasStatsDcField ? reader.readInt32() : null;
  final pts = reader.readInt32();
  final hasCallField = (flags & 2097152) != 0;
  final call =
      hasCallField ? reader.readObject() as InputGroupCallBase : null;
  final hasTtlPeriodField = (flags & 16777216) != 0;
  final ttlPeriod = hasTtlPeriodField ? reader.readInt32() : null;
  final hasPendingSuggestionsField = (flags & 33554432) != 0;
  final pendingSuggestions =
      hasPendingSuggestionsField ? reader.readVectorString() : null;
  final hasGroupcallDefaultJoinAsField = (flags & 67108864) != 0;
  final groupcallDefaultJoinAs =
      hasGroupcallDefaultJoinAsField ? reader.readObject() as PeerBase : null;
  final hasThemeEmoticonField = (flags & 134217728) != 0;
  final themeEmoticon = hasThemeEmoticonField ? reader.readString() : null;
  final hasRequestsPendingField = (flags & 268435456) != 0;
  final requestsPending = hasRequestsPendingField ? reader.readInt32() : null;
  final hasRecentRequestersField = (flags & 268435456) != 0;
  final recentRequesters =
      hasRecentRequestersField ? reader.readVectorInt64() : null;
  final hasDefaultSendAsField = (flags & 536870912) != 0;
  final defaultSendAs =
      hasDefaultSendAsField ? reader.readObject() as PeerBase : null;
  final hasAvailableReactionsField = (flags & 1073741824) != 0;
  final availableReactions = hasAvailableReactionsField
      ? reader.readObject() as ChatReactionsBase
      : null;
  final hasStoriesField = (flags2 & 16) != 0;
  final stories =
      hasStoriesField ? reader.readObject() as PeerStoriesBase : null;
  final hasWallpaperField = (flags2 & 128) != 0;
  final wallpaper =
      hasWallpaperField ? reader.readObject() as WallPaperBase : null;

  // Construct [ChannelFull] object.
  final returnValue = ChannelFull(
    canViewParticipants: canViewParticipants,
    canSetUsername: canSetUsername,
    canSetStickers: canSetStickers,
    hiddenPrehistory: hiddenPrehistory,
    canSetLocation: canSetLocation,
    hasScheduled: hasScheduled,
    canViewStats: canViewStats,
    blocked: blocked,
    canDeleteChannel: canDeleteChannel,
    antispam: antispam,
    participantsHidden: participantsHidden,
    translationsDisabled: translationsDisabled,
    storiesPinnedAvailable: storiesPinnedAvailable,
    viewForumAsMessages: viewForumAsMessages,
    id: id,
    about: about,
    participantsCount: participantsCount,
    adminsCount: adminsCount,
    kickedCount: kickedCount,
    bannedCount: bannedCount,
    onlineCount: onlineCount,
    readInboxMaxId: readInboxMaxId,
    readOutboxMaxId: readOutboxMaxId,
    unreadCount: unreadCount,
    chatPhoto: chatPhoto,
    notifySettings: notifySettings,
    exportedInvite: exportedInvite,
    botInfo: botInfo,
    migratedFromChatId: migratedFromChatId,
    migratedFromMaxId: migratedFromMaxId,
    pinnedMsgId: pinnedMsgId,
    stickerset: stickerset,
    availableMinId: availableMinId,
    folderId: folderId,
    linkedChatId: linkedChatId,
    location: location,
    slowmodeSeconds: slowmodeSeconds,
    slowmodeNextSendDate: slowmodeNextSendDate,
    statsDc: statsDc,
    pts: pts,
    call: call,
    ttlPeriod: ttlPeriod,
    pendingSuggestions: pendingSuggestions,
    groupcallDefaultJoinAs: groupcallDefaultJoinAs,
    themeEmoticon: themeEmoticon,
    requestsPending: requestsPending,
    recentRequesters: recentRequesters,
    defaultSendAs: defaultSendAs,
    availableReactions: availableReactions,
    stories: stories,
    wallpaper: wallpaper,
  );

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