Skip to content

Commit 1412041

Browse files
[in_app_purchase] Update country code Android example (#6722)
Updates the Android example app to use the replacement for the deprecated `getCountryCode`. Also udpates the deprecations method for `getCountryCode` to point to the correct variant of the platform interface method. Follow-up to flutter/flutter#147230
1 parent f91f689 commit 1412041

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.3.5+1
2+
3+
* Updates example to use `countryCode` instead of deprecated `getCountryCode`.
4+
15
## 0.3.5
26

37
* Replaces `getCountryCode` with `countryCode`.

packages/in_app_purchase/in_app_purchase_android/example/lib/main.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,7 @@ class _MyAppState extends State<_MyApp> {
259259
foregroundColor: Colors.white,
260260
),
261261
onPressed: () {
262-
final InAppPurchaseAndroidPlatformAddition addition =
263-
InAppPurchasePlatformAddition.instance!
264-
as InAppPurchaseAndroidPlatformAddition;
265-
unawaited(deliverCountryCode(addition.getCountryCode()));
262+
unawaited(deliverCountryCode(_inAppPurchasePlatform.countryCode()));
266263
},
267264
child: const Text('Fetch Country Code'),
268265
),

packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class InAppPurchaseAndroidPlatformAddition
167167
///
168168
/// See: https://developer.android.com/reference/com/android/billingclient/api/BillingConfig
169169
/// See: https://unicode.org/cldr/charts/latest/supplemental/territory_containment_un_m_49.html
170-
@Deprecated('Use InAppPurchasePlatfrom.getCountryCode')
170+
@Deprecated('Use InAppPurchasePlatfrom.countryCode')
171171
Future<String> getCountryCode() async {
172172
final BillingConfigWrapper billingConfig = await _billingClientManager
173173
.runWithClient((BillingClient client) => client.getBillingConfig());

packages/in_app_purchase/in_app_purchase_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: in_app_purchase_android
22
description: An implementation for the Android platform of the Flutter `in_app_purchase` plugin. This uses the Android BillingClient APIs.
33
repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22
5-
version: 0.3.5
5+
version: 0.3.5+1
66

77
environment:
88
sdk: ^3.1.0

0 commit comments

Comments
 (0)