ChatFull.deserialize constructor

ChatFull.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory ChatFull.deserialize(BinaryReader reader) {
  // Read [ChatFull] fields.
  final flags = reader.readInt32();
  final canSetUsername = (flags & 128) != 0;
  final hasScheduled = (flags & 256) != 0;
  final translationsDisabled = (flags & 524288) != 0;
  final id = reader.readInt64();
  final about = reader.readString();
  final participants = reader.readObject() as ChatParticipantsBase;
  final hasChatPhotoField = (flags & 4) != 0;
  final chatPhoto =
      hasChatPhotoField ? reader.readObject() as PhotoBase : null;
  final notifySettings = reader.readObject() as PeerNotifySettingsBase;
  final hasExportedInviteField = (flags & 8192) != 0;
  final exportedInvite = hasExportedInviteField
      ? reader.readObject() as ExportedChatInviteBase
      : null;
  final hasBotInfoField = (flags & 8) != 0;
  final botInfo =
      hasBotInfoField ? reader.readVectorObject<BotInfoBase>() : null;
  final hasPinnedMsgIdField = (flags & 64) != 0;
  final pinnedMsgId = hasPinnedMsgIdField ? reader.readInt32() : null;
  final hasFolderIdField = (flags & 2048) != 0;
  final folderId = hasFolderIdField ? reader.readInt32() : null;
  final hasCallField = (flags & 4096) != 0;
  final call =
      hasCallField ? reader.readObject() as InputGroupCallBase : null;
  final hasTtlPeriodField = (flags & 16384) != 0;
  final ttlPeriod = hasTtlPeriodField ? reader.readInt32() : null;
  final hasGroupcallDefaultJoinAsField = (flags & 32768) != 0;
  final groupcallDefaultJoinAs =
      hasGroupcallDefaultJoinAsField ? reader.readObject() as PeerBase : null;
  final hasThemeEmoticonField = (flags & 65536) != 0;
  final themeEmoticon = hasThemeEmoticonField ? reader.readString() : null;
  final hasRequestsPendingField = (flags & 131072) != 0;
  final requestsPending = hasRequestsPendingField ? reader.readInt32() : null;
  final hasRecentRequestersField = (flags & 131072) != 0;
  final recentRequesters =
      hasRecentRequestersField ? reader.readVectorInt64() : null;
  final hasAvailableReactionsField = (flags & 262144) != 0;
  final availableReactions = hasAvailableReactionsField
      ? reader.readObject() as ChatReactionsBase
      : null;

  // Construct [ChatFull] object.
  final returnValue = ChatFull(
    canSetUsername: canSetUsername,
    hasScheduled: hasScheduled,
    translationsDisabled: translationsDisabled,
    id: id,
    about: about,
    participants: participants,
    chatPhoto: chatPhoto,
    notifySettings: notifySettings,
    exportedInvite: exportedInvite,
    botInfo: botInfo,
    pinnedMsgId: pinnedMsgId,
    folderId: folderId,
    call: call,
    ttlPeriod: ttlPeriod,
    groupcallDefaultJoinAs: groupcallDefaultJoinAs,
    themeEmoticon: themeEmoticon,
    requestsPending: requestsPending,
    recentRequesters: recentRequesters,
    availableReactions: availableReactions,
  );

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