Skip to content

Commit ca29e22

Browse files
committed
Ensure introductoryPriceAmountMicros field to be String.
Converts the introductoryPriceAmountMicros field to a String value before it is send as JSON string from Java to Dart. This will solve the issue (flutter#4364 (comment)) in a non-breaking manor (updating the type on the Dart side would introduce a breaking change).
1 parent 9e90da1 commit ca29e22

File tree

1 file changed

+3
-1
lines changed
  • packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase

1 file changed

+3
-1
lines changed

packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/Translator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ static HashMap<String, Object> fromSkuDetail(SkuDetails detail) {
2626
info.put("description", detail.getDescription());
2727
info.put("freeTrialPeriod", detail.getFreeTrialPeriod());
2828
info.put("introductoryPrice", detail.getIntroductoryPrice());
29-
info.put("introductoryPriceAmountMicros", detail.getIntroductoryPriceAmountMicros());
29+
// Make sure the `introductoryPriceAmountMicros` field is returned as a `String` value as the
30+
// Dart side expects it as `String`. Changing the type in Dart would introduce a breaking change.
31+
info.put("introductoryPriceAmountMicros", String.valueOf(detail.getIntroductoryPriceAmountMicros()));
3032
info.put("introductoryPriceCycles", detail.getIntroductoryPriceCycles());
3133
info.put("introductoryPricePeriod", detail.getIntroductoryPricePeriod());
3234
info.put("price", detail.getPrice());

0 commit comments

Comments
 (0)