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/stores/cart_item_store.dart

19 lines
572 B

import 'package:mobx/mobx.dart';
import 'package:thesis_shop/models/product.dart';
import 'package:thesis_shop/stores/cart_store.dart';
part 'cart_item_store.g.dart';
class CartItemStore = _CartItemStore with _$CartItemStore;
abstract class _CartItemStore with Store {
final Product _product;
final CartStore _store;
_CartItemStore(this._product, this._store);
@computed
int get quantity => _store.amountOfProduct(_product);
void increment() => _store.incrementAmountOfProduct(_product);
void decrement() => _store.decrementAmountOfProduct(_product);
}