CartController class
Manages the shopping cart functionality, including adding, removing, and updating items in the cart.
Constructors
Properties
-
cartListenable
→ ValueListenable<
Box< PersistentShoppingCartItem> > -
A ValueListenable for the cart box, allowing widgets to listen for changes in the cart.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addToCart(
PersistentShoppingCartItem item) → void - Adds a PersistentShoppingCartItem to the shopping cart.
-
calculateTotalPrice(
) → double - Calculates the total price of all items in the shopping cart.
-
clearCart(
) → void - Clears all items from the shopping cart.
-
decrementQuantity(
String productId) → void - Decrements the quantity of a cart item.
-
getCartItemCount(
) → int - Gets the total number of items in the shopping cart.
-
getCartItems(
) → List< PersistentShoppingCartItem> - Retrieves a list of PersistentShoppingCartItem from the shopping cart.
-
getTotalPrice(
) → double - Gets the total price of all items in the shopping cart.
-
incrementQuantity(
String productId) → void - Increments the quantity of a cart item.
-
isItemExistsInCart(
String productId) → bool -
Checks if a product with the given
productId
exists in the shopping cart. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeFromCart(
String productId) → bool - Removes a product from the shopping cart.
-
removeProduct(
String productId) → bool -
Removes a product from the cart using the
productId
. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited