getPurchaseList method
Future<List<ProductDetails?> ?>
getPurchaseList(
- List<
String> purchase_ids, - String purchase_type,
- PurchaseListener? listener
override
Implementation
@override
Future<List<ProductDetails?>?> getPurchaseList(List<String> purchase_ids,
String purchase_type, PurchaseListener? listener) async {
this.listener = listener;
final List<PurchaseId> pricingList = [];
purchase_ids.forEach((element) {
pricingList
.add(PurchaseId(purchaseId: element, purchaseType: purchase_type));
});
final price = await methodChannel.invokeMethod<String?>(
'getPurchaseList', {"purchases": purchaseIdToJson(pricingList)});
if ((price ?? "").isEmpty) {
return List.empty();
}
final List<ProductDetails> retrievePricingList = [];
productDetailsResponseFromJson(price!).forEach((element) {
if ((element.zza ?? "").isNotEmpty) {
retrievePricingList.add(productDetailsFromJson(element.zza!));
}
});
print(
"ZZA ==> ${retrievePricingList.length} ---> ${jsonEncode(retrievePricingList)}");
return retrievePricingList;
}