MessageActionGiftStars.deserialize constructor

MessageActionGiftStars.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory MessageActionGiftStars.deserialize(BinaryReader reader) {
  // Read [MessageActionGiftStars] fields.
  final flags = reader.readInt32();
  final currency = reader.readString();
  final amount = reader.readInt64();
  final stars = reader.readInt64();
  final hasCryptoCurrencyField = (flags & 1) != 0;
  final cryptoCurrency = hasCryptoCurrencyField ? reader.readString() : null;
  final hasCryptoAmountField = (flags & 1) != 0;
  final cryptoAmount = hasCryptoAmountField ? reader.readInt64() : null;
  final hasTransactionIdField = (flags & 2) != 0;
  final transactionId = hasTransactionIdField ? reader.readString() : null;

  // Construct [MessageActionGiftStars] object.
  final returnValue = MessageActionGiftStars(
    currency: currency,
    amount: amount,
    stars: stars,
    cryptoCurrency: cryptoCurrency,
    cryptoAmount: cryptoAmount,
    transactionId: transactionId,
  );

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