1
0
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
thesis_shop/lib/models/cart_item.dart

14 lines
380 B

import 'package:flutter/foundation.dart';
import 'package:thesis_shop/models/product.dart';
@immutable
class CartItem {
final Product product;
final int amount;
double get totalPrice => product.price * amount;
String get totalPriceAsString => totalPrice.toStringAsFixed(2);
const CartItem({required this.product, required this.amount})
: assert(amount >= 0);
}