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.
14 lines
380 B
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);
|
|
}
|
|
|