PhotosUpdateProfilePhoto.deserialize constructor

PhotosUpdateProfilePhoto.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory PhotosUpdateProfilePhoto.deserialize(BinaryReader reader) {
  // Read [PhotosUpdateProfilePhoto] fields.
  final flags = reader.readInt32();
  final fallback = (flags & 1) != 0;
  final hasBotField = (flags & 2) != 0;
  final bot = hasBotField ? reader.readObject() as InputUserBase : null;
  final id = reader.readObject() as InputPhotoBase;

  // Construct [PhotosUpdateProfilePhoto] object.
  final returnValue = PhotosUpdateProfilePhoto(
    fallback: fallback,
    bot: bot,
    id: id,
  );

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