UpdateBotPrecheckoutQuery.deserialize constructor

UpdateBotPrecheckoutQuery.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory UpdateBotPrecheckoutQuery.deserialize(BinaryReader reader) {
  // Read [UpdateBotPrecheckoutQuery] fields.
  final flags = reader.readInt32();
  final queryId = reader.readInt64();
  final userId = reader.readInt64();
  final payload = reader.readBytes();
  final hasInfoField = (flags & 1) != 0;
  final info =
      hasInfoField ? reader.readObject() as PaymentRequestedInfoBase : null;
  final hasShippingOptionIdField = (flags & 2) != 0;
  final shippingOptionId =
      hasShippingOptionIdField ? reader.readString() : null;
  final currency = reader.readString();
  final totalAmount = reader.readInt64();

  // Construct [UpdateBotPrecheckoutQuery] object.
  final returnValue = UpdateBotPrecheckoutQuery(
    queryId: queryId,
    userId: userId,
    payload: payload,
    info: info,
    shippingOptionId: shippingOptionId,
    currency: currency,
    totalAmount: totalAmount,
  );

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