BotInlineMessageMediaInvoice.deserialize constructor

BotInlineMessageMediaInvoice.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory BotInlineMessageMediaInvoice.deserialize(BinaryReader reader) {
  // Read [BotInlineMessageMediaInvoice] fields.
  final flags = reader.readInt32();
  final shippingAddressRequested = (flags & 2) != 0;
  final test = (flags & 8) != 0;
  final title = reader.readString();
  final description = reader.readString();
  final hasPhotoField = (flags & 1) != 0;
  final photo = hasPhotoField ? reader.readObject() as WebDocumentBase : null;
  final currency = reader.readString();
  final totalAmount = reader.readInt64();
  final hasReplyMarkupField = (flags & 4) != 0;
  final replyMarkup =
      hasReplyMarkupField ? reader.readObject() as ReplyMarkupBase : null;

  // Construct [BotInlineMessageMediaInvoice] object.
  final returnValue = BotInlineMessageMediaInvoice(
    shippingAddressRequested: shippingAddressRequested,
    test: test,
    title: title,
    description: description,
    photo: photo,
    currency: currency,
    totalAmount: totalAmount,
    replyMarkup: replyMarkup,
  );

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