nonRenewingPurchases static method

Future<List<ApphudNonRenewingPurchase>> nonRenewingPurchases()

Returns an array of all standard in-app purchases (consumables, non-consumables or non-renewing subscriptions) that this user has ever purchased.

Purchases are cached on device. This array is sorted by purchase date. Apphud only tracks consumables if they were purchased after integrating Apphud SDK.

Implementation

static Future<List<ApphudNonRenewingPurchase>> nonRenewingPurchases() async {
  final List<Map<dynamic, dynamic>>? purchases =
      (await _channel.invokeMethod<List<dynamic>>('nonRenewingPurchases'))
          ?.toMapList;

  if (purchases != null) {
    return purchases
        .map((json) => ApphudNonRenewingPurchase.fromJson(json))
        .toList();
  }
  return List<ApphudNonRenewingPurchase>.of([]);
}