Skip to content

Commit

Permalink
Product: Add missing currencyCode
Browse files Browse the repository at this point in the history
  • Loading branch information
ciriousjoker committed Jan 22, 2023
1 parent 13ee0cc commit 7ee0f27
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion example/lib/product_listview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ProductListViewState extends State<ProductListView> {
color: Colors.black54,
fontWeight: FontWeight.bold,
fontSize: 18)),
subtitle: Text(listProducts[pos].price,
subtitle: Text(listProducts[pos].price + " (currencyCode: "+ listProducts[pos].currencyCode + ")",
style: const TextStyle(
fontWeight: FontWeight.normal,
fontSize: 15)),
Expand Down
6 changes: 4 additions & 2 deletions lib/src/utils/product.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ class Product {
String id;
String price;
String title;
Product(this.id, this.price, this.title);
String currencyCode;

Product(this.id, this.price, this.title, this.currencyCode);

factory Product.fromJson(dynamic json) {
print(json);

return Product(json['productId'] as String, json['productPrice'] as String,
json['productTitle'] as String);
json['productTitle'] as String, json['currencyCode'] as String);
}
}

Expand Down

0 comments on commit 7ee0f27

Please sign in to comment.