From 7cca3b9a274b4974fc315bfbbfae9c458e7f5a94 Mon Sep 17 00:00:00 2001 From: Mykola Chykin Date: Thu, 7 Mar 2024 18:23:08 -0800 Subject: [PATCH] * On android for inapp products. Fixed NullPointerException: offerToken is required for constructing ProductDetailsParams --- CHANGELOG.md | 2 ++ .../flutterinapppurchase/AndroidInappPurchasePlugin.kt | 5 +++-- pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9f6ff75..dbb17932 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## 5.6.2 +* On android for inapp products. Fixed NullPointerException: offerToken is required for constructing ProductDetailsParams ## 5.6.1 * Erroneous duplicate item by @deakjahn in https://github.com/dooboolab-community/flutter_inapp_purchase/pull/441 * Fixed consumable products reading on Android by @33-Elephants in https://github.com/dooboolab-community/flutter_inapp_purchase/pull/439 diff --git a/android/src/main/kotlin/com/dooboolab/flutterinapppurchase/AndroidInappPurchasePlugin.kt b/android/src/main/kotlin/com/dooboolab/flutterinapppurchase/AndroidInappPurchasePlugin.kt index f949209a..9a9861f4 100644 --- a/android/src/main/kotlin/com/dooboolab/flutterinapppurchase/AndroidInappPurchasePlugin.kt +++ b/android/src/main/kotlin/com/dooboolab/flutterinapppurchase/AndroidInappPurchasePlugin.kt @@ -537,9 +537,10 @@ class AndroidInappPurchasePlugin internal constructor() : MethodCallHandler, if (offerToken == null) { offerToken = selectedProductDetails.subscriptionOfferDetails!![0].offerToken } - - productDetailsParamsBuilder.setOfferToken(offerToken) + } else { + offerToken = selectedProductDetails.subscriptionOfferDetails!![0].offerToken } + productDetailsParamsBuilder.setOfferToken(offerToken) val productDetailsParamsList = listOf(productDetailsParamsBuilder.build()) diff --git a/pubspec.yaml b/pubspec.yaml index a711c9e1..743ab36d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: flutter_inapp_purchase description: In App Purchase plugin for flutter. This project has been forked by react-native-iap and we are willing to share same experience with that on react-native. -version: 5.6.1 +version: 5.6.2 homepage: https://github.com/dooboolab/flutter_inapp_purchase/blob/main/pubspec.yaml environment: sdk: ">=2.15.0 <4.0.0"