InputMediaPhoto.deserialize constructor

InputMediaPhoto.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory InputMediaPhoto.deserialize(BinaryReader reader) {
  // Read [InputMediaPhoto] fields.
  final flags = reader.readInt32();
  final spoiler = (flags & 2) != 0;
  final livePhoto = (flags & 4) != 0;
  final id = reader.readObject() as InputPhotoBase;
  final hasTtlSecondsField = (flags & 1) != 0;
  final ttlSeconds = hasTtlSecondsField ? reader.readInt32() : null;
  final hasVideoField = (flags & 4) != 0;
  final video =
      hasVideoField ? reader.readObject() as InputDocumentBase : null;

  // Construct [InputMediaPhoto] object.
  final returnValue = InputMediaPhoto(
    spoiler: spoiler,
    livePhoto: livePhoto,
    id: id,
    ttlSeconds: ttlSeconds,
    video: video,
  );

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