purchaseSubscription method
Implementation
Future<void> purchaseSubscription(IAPItem item) async {
try {
// Request a subscription purchase using the FlutterInappPurchase instance.
await FlutterInappPurchase.instance.requestSubscription(item.productId!);
} catch (e) {
// Log any errors that occur during the purchase.
if (kDebugMode) {
print("Failed to purchase subscription: $e");
}
}
}