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 id = reader.readObject() as InputPhotoBase;
  final hasTtlSecondsField = (flags & 1) != 0;
  final ttlSeconds = hasTtlSecondsField ? reader.readInt32() : null;

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

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