Skip to content

Commit 0da7eb1

Browse files
renefloorfotiDim
authored andcommitted
[in_app_purchase] Add currencySymbol to ProductDetails (flutter#4115)
1 parent cd5f38e commit 0da7eb1

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

packages/in_app_purchase/in_app_purchase_platform_interface/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.1.0
2+
3+
* Added `currencySymbol` in ProductDetails.
4+
15
## 1.0.1
26

37
* Fixed `Restoring previous purchases` link.

packages/in_app_purchase/in_app_purchase_platform_interface/lib/src/types/product_details.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class ProductDetails {
1212
required this.price,
1313
required this.rawPrice,
1414
required this.currencyCode,
15+
this.currencySymbol = '',
1516
});
1617

1718
/// The identifier of the product.
@@ -42,4 +43,9 @@ class ProductDetails {
4243
/// The currency code for the price of the product.
4344
/// Based on the price specified in the App Store Connect or Sku in Google Play console based on the platform.
4445
final String currencyCode;
46+
47+
/// The currency symbol for the locale, e.g. $ for US locale.
48+
///
49+
/// When the currency symbol cannot be determined, the ISO 4217 currency code is returned.
50+
final String currencySymbol;
4551
}

packages/in_app_purchase/in_app_purchase_platform_interface/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ repository: https://github.com/flutter/plugins/tree/master/packages/in_app_purch
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22
55
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
66
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
7-
version: 1.0.1
7+
version: 1.1.0
88

99
environment:
1010
sdk: ">=2.12.0 <3.0.0"

packages/in_app_purchase/in_app_purchase_platform_interface/test/src/types/product_details_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ void main() {
1616
description: 'description',
1717
price: '13.37',
1818
currencyCode: 'USD',
19+
currencySymbol: r'$',
1920
rawPrice: 13.37);
2021

2122
expect(productDetails.id, 'id');
2223
expect(productDetails.title, 'title');
2324
expect(productDetails.description, 'description');
2425
expect(productDetails.rawPrice, 13.37);
2526
expect(productDetails.currencyCode, 'USD');
27+
expect(productDetails.currencySymbol, r'$');
2628
});
2729
});
2830
}

0 commit comments

Comments
 (0)