mirror of
https://github.com/Mercantec-GHC/h4-projekt-gruppe-0-sm.git
synced 2025-04-28 00:34:06 +02:00
20 lines
464 B
Dart
20 lines
464 B
Dart
import 'package:mobile/models/product.dart';
|
|
|
|
class CartItem {
|
|
final Product product;
|
|
int amount;
|
|
|
|
CartItem({required this.product, required this.amount});
|
|
|
|
static Map<String, dynamic> toJson(CartItem cartItem) {
|
|
return {
|
|
"product": Product.toJson(cartItem.product),
|
|
"amount": cartItem.amount
|
|
};
|
|
}
|
|
|
|
CartItem.fromJson(Map<String, dynamic> json)
|
|
: product = Product.fromJson(json["product"]),
|
|
amount = json["amount"];
|
|
}
|