ChatInvite.deserialize constructor

ChatInvite.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory ChatInvite.deserialize(BinaryReader reader) {
  // Read [ChatInvite] fields.
  final flags = reader.readInt32();
  final channel = (flags & 1) != 0;
  final broadcast = (flags & 2) != 0;
  final public = (flags & 4) != 0;
  final megagroup = (flags & 8) != 0;
  final requestNeeded = (flags & 64) != 0;
  final verified = (flags & 128) != 0;
  final scam = (flags & 256) != 0;
  final fake = (flags & 512) != 0;
  final title = reader.readString();
  final hasAboutField = (flags & 32) != 0;
  final about = hasAboutField ? reader.readString() : null;
  final photo = reader.readObject() as PhotoBase;
  final participantsCount = reader.readInt32();
  final hasParticipantsField = (flags & 16) != 0;
  final participants =
      hasParticipantsField ? reader.readVectorObject<UserBase>() : null;
  final color = reader.readInt32();

  // Construct [ChatInvite] object.
  final returnValue = ChatInvite(
    channel: channel,
    broadcast: broadcast,
    public: public,
    megagroup: megagroup,
    requestNeeded: requestNeeded,
    verified: verified,
    scam: scam,
    fake: fake,
    title: title,
    about: about,
    photo: photo,
    participantsCount: participantsCount,
    participants: participants,
    color: color,
  );

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