StarsTopupOption.deserialize constructor

StarsTopupOption.deserialize(
  1. BinaryReader reader
)

Deserialize.

Implementation

factory StarsTopupOption.deserialize(BinaryReader reader) {
  // Read [StarsTopupOption] fields.
  final flags = reader.readInt32();
  final extended = (flags & 2) != 0;
  final stars = reader.readInt64();
  final hasStoreProductField = (flags & 1) != 0;
  final storeProduct = hasStoreProductField ? reader.readString() : null;
  final currency = reader.readString();
  final amount = reader.readInt64();

  // Construct [StarsTopupOption] object.
  final returnValue = StarsTopupOption(
    extended: extended,
    stars: stars,
    storeProduct: storeProduct,
    currency: currency,
    amount: amount,
  );

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