PremiumBoostsStatus.deserialize constructor
PremiumBoostsStatus.deserialize(
- BinaryReader reader
Deserialize.
Implementation
factory PremiumBoostsStatus.deserialize(BinaryReader reader) {
// Read [PremiumBoostsStatus] fields.
final flags = reader.readInt32();
final myBoost = (flags & 4) != 0;
final level = reader.readInt32();
final currentLevelBoosts = reader.readInt32();
final boosts = reader.readInt32();
final hasGiftBoostsField = (flags & 16) != 0;
final giftBoosts = hasGiftBoostsField ? reader.readInt32() : null;
final hasNextLevelBoostsField = (flags & 1) != 0;
final nextLevelBoosts = hasNextLevelBoostsField ? reader.readInt32() : null;
final hasPremiumAudienceField = (flags & 2) != 0;
final premiumAudience = hasPremiumAudienceField
? reader.readObject() as StatsPercentValueBase
: null;
final boostUrl = reader.readString();
final hasPrepaidGiveawaysField = (flags & 8) != 0;
final prepaidGiveaways = hasPrepaidGiveawaysField
? reader.readVectorObject<PrepaidGiveawayBase>()
: null;
final hasMyBoostSlotsField = (flags & 4) != 0;
final myBoostSlots = hasMyBoostSlotsField ? reader.readVectorInt32() : null;
// Construct [PremiumBoostsStatus] object.
final returnValue = PremiumBoostsStatus(
myBoost: myBoost,
level: level,
currentLevelBoosts: currentLevelBoosts,
boosts: boosts,
giftBoosts: giftBoosts,
nextLevelBoosts: nextLevelBoosts,
premiumAudience: premiumAudience,
boostUrl: boostUrl,
prepaidGiveaways: prepaidGiveaways,
myBoostSlots: myBoostSlots,
);
// Now return the deserialized [PremiumBoostsStatus].
return returnValue;
}