RequestedPeerChat.deserialize constructor

RequestedPeerChat.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory RequestedPeerChat.deserialize(BinaryReader reader) {
  // Read [RequestedPeerChat] fields.
  final flags = reader.readInt32();
  final chatId = reader.readInt64();
  final hasTitleField = (flags & 1) != 0;
  final title = hasTitleField ? reader.readString() : null;
  final hasPhotoField = (flags & 4) != 0;
  final photo = hasPhotoField ? reader.readObject() as PhotoBase : null;

  // Construct [RequestedPeerChat] object.
  final returnValue = RequestedPeerChat(
    chatId: chatId,
    title: title,
    photo: photo,
  );

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