UserProfilePhoto.deserialize constructor

UserProfilePhoto.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

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

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

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