File tree Expand file tree Collapse file tree 4 files changed +38
-7
lines changed
packages/in_app_purchase/in_app_purchase Expand file tree Collapse file tree 4 files changed +38
-7
lines changed Original file line number Diff line number Diff line change 1- ## NEXT
1+ ## 3.2.0
22
3+ * Adds ` countryCode ` API.
34* Updates minimum supported SDK version to Flutter 3.13/Dart 3.1.
45* Updates support matrix in README to indicate that iOS 11 is no longer supported.
56* Clients on versions of Flutter that still support iOS 11 can continue to use this
Original file line number Diff line number Diff line change @@ -209,4 +209,20 @@ class InAppPurchase implements InAppPurchasePlatformAdditionProvider {
209209 InAppPurchasePlatform .instance.restorePurchases (
210210 applicationUserName: applicationUserName,
211211 );
212+
213+ /// Returns the user's country.
214+ ///
215+ /// Android:
216+ /// Returns Play billing country code based on ISO-3166-1 alpha2 format.
217+ ///
218+ /// See: https://developer.android.com/reference/com/android/billingclient/api/BillingConfig
219+ /// See: https://unicode.org/cldr/charts/latest/supplemental/territory_containment_un_m_49.html
220+ ///
221+ /// iOS:
222+ /// Returns the country code from SKStoreFrontWrapper.
223+ ///
224+ /// See: https://developer.apple.com/documentation/storekit/skstorefront?language=objc
225+ ///
226+ ///
227+ Future <String > countryCode () => InAppPurchasePlatform .instance.countryCode ();
212228}
Original file line number Diff line number Diff line change @@ -2,11 +2,11 @@ name: in_app_purchase
22description : A Flutter plugin for in-app purchases. Exposes APIs for making in-app purchases through the App Store and Google Play.
33repository : https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase
44issue_tracker : https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22
5- version : 3.1.13
5+ version : 3.2.0
66
77environment :
8- sdk : ^3.1.0
9- flutter : " >=3.13.0 "
8+ sdk : ^3.2.3
9+ flutter : " >=3.16.6 "
1010
1111flutter :
1212 plugin :
@@ -21,9 +21,9 @@ flutter:
2121dependencies :
2222 flutter :
2323 sdk : flutter
24- in_app_purchase_android : ^0.3.0
25- in_app_purchase_platform_interface : ^1.0 .0
26- in_app_purchase_storekit : ^0.3.4
24+ in_app_purchase_android : ^0.3.4
25+ in_app_purchase_platform_interface : ^1.4 .0
26+ in_app_purchase_storekit : ^0.3.14
2727
2828dev_dependencies :
2929 flutter_test :
Original file line number Diff line number Diff line change @@ -55,6 +55,14 @@ void main() {
5555 ]);
5656 });
5757
58+ test ('countryCode' , () async {
59+ final String country = await inAppPurchase.countryCode ();
60+ expect (country, 'USA' );
61+ expect (fakePlatform.log, < Matcher > [
62+ isMethodCall ('countryCode' , arguments: null ),
63+ ]);
64+ });
65+
5866 test ('purchaseStream' , () async {
5967 final bool isEmptyStream = await inAppPurchase.purchaseStream.isEmpty;
6068 expect (isEmptyStream, true );
@@ -192,4 +200,10 @@ class MockInAppPurchasePlatform extends Fake
192200 log.add (const MethodCall ('restorePurchases' ));
193201 return Future <void >.value ();
194202 }
203+
204+ @override
205+ Future <String > countryCode () {
206+ log.add (const MethodCall ('countryCode' ));
207+ return Future <String >.value ('USA' );
208+ }
195209}
You can’t perform that action at this time.
0 commit comments