MessageActionGiftPremium.deserialize constructor
MessageActionGiftPremium.deserialize(
- BinaryReader reader
Deserialize.
Implementation
factory MessageActionGiftPremium.deserialize(BinaryReader reader) {
// Read [MessageActionGiftPremium] fields.
final flags = reader.readInt32();
final currency = reader.readString();
final amount = reader.readInt64();
final months = reader.readInt32();
final hasCryptoCurrencyField = (flags & 1) != 0;
final cryptoCurrency = hasCryptoCurrencyField ? reader.readString() : null;
final hasCryptoAmountField = (flags & 1) != 0;
final cryptoAmount = hasCryptoAmountField ? reader.readInt64() : null;
// Construct [MessageActionGiftPremium] object.
final returnValue = MessageActionGiftPremium(
currency: currency,
amount: amount,
months: months,
cryptoCurrency: cryptoCurrency,
cryptoAmount: cryptoAmount,
);
// Now return the deserialized [MessageActionGiftPremium].
return returnValue;
}