UpdateChannelParticipant.deserialize constructor

UpdateChannelParticipant.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory UpdateChannelParticipant.deserialize(BinaryReader reader) {
  // Read [UpdateChannelParticipant] fields.
  final flags = reader.readInt32();
  final viaChatlist = (flags & 8) != 0;
  final channelId = reader.readInt64();
  final date = reader.readDateTime();
  final actorId = reader.readInt64();
  final userId = reader.readInt64();
  final hasPrevParticipantField = (flags & 1) != 0;
  final prevParticipant = hasPrevParticipantField
      ? reader.readObject() as ChannelParticipantBase
      : null;
  final hasNewParticipantField = (flags & 2) != 0;
  final newParticipant = hasNewParticipantField
      ? reader.readObject() as ChannelParticipantBase
      : null;
  final hasInviteField = (flags & 4) != 0;
  final invite =
      hasInviteField ? reader.readObject() as ExportedChatInviteBase : null;
  final qts = reader.readInt32();

  // Construct [UpdateChannelParticipant] object.
  final returnValue = UpdateChannelParticipant(
    viaChatlist: viaChatlist,
    channelId: channelId,
    date: date,
    actorId: actorId,
    userId: userId,
    prevParticipant: prevParticipant,
    newParticipant: newParticipant,
    invite: invite,
    qts: qts,
  );

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