removeFromCart method

bool removeFromCart(
  1. String productId
)

Removes a product from the shopping cart.

Returns true if the product is successfully removed, false if the product is not found in the cart.

Implementation

bool removeFromCart(String productId) {
  if (_cartBox.keys.contains(productId)) {
    _cartBox.delete(productId);
    return true; // Product successfully removed
  } else {
    return false; // Product not found in the cart
  }
}