totalVbucksPurchased property

int totalVbucksPurchased

get total vbucks purchased till now of profile

Implementation

int get totalVbucksPurchased {
  confirmInitialized();

  if (stats["in_app_purchases"]?["fulfillmentCounts"] == null) {
    return 0;
  }

  List<num> _purchases =
      (stats["in_app_purchases"]["fulfillmentCounts"] as Map<String, dynamic>)
          .entries
          .where((element) => element.key.startsWith("FN_"))
          .map((e) => int.parse(e.key.split("_")[1]) * e.value)
          .toList();

  if (_purchases.isEmpty) {
    return 0;
  }

  return _purchases.reduce((a, b) => a + b).toInt();
}