ChatPhoto.deserialize constructor

ChatPhoto.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory ChatPhoto.deserialize(BinaryReader reader) {
  // Read [ChatPhoto] fields.
  final flags = reader.readInt32();
  final hasVideo = (flags & 1) != 0;
  final photoId = reader.readInt64();
  final hasStrippedThumbField = (flags & 2) != 0;
  final strippedThumb = hasStrippedThumbField ? reader.readBytes() : null;
  final dcId = reader.readInt32();

  // Construct [ChatPhoto] object.
  final returnValue = ChatPhoto(
    hasVideo: hasVideo,
    photoId: photoId,
    strippedThumb: strippedThumb,
    dcId: dcId,
  );

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