InputMediaUploadedPhoto.deserialize constructor

InputMediaUploadedPhoto.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory InputMediaUploadedPhoto.deserialize(BinaryReader reader) {
  // Read [InputMediaUploadedPhoto] fields.
  final flags = reader.readInt32();
  final spoiler = (flags & 4) != 0;
  final file = reader.readObject() as InputFileBase;
  final hasStickersField = (flags & 1) != 0;
  final stickers =
      hasStickersField ? reader.readVectorObject<InputDocumentBase>() : null;
  final hasTtlSecondsField = (flags & 2) != 0;
  final ttlSeconds = hasTtlSecondsField ? reader.readInt32() : null;

  // Construct [InputMediaUploadedPhoto] object.
  final returnValue = InputMediaUploadedPhoto(
    spoiler: spoiler,
    file: file,
    stickers: stickers,
    ttlSeconds: ttlSeconds,
  );

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