removeProduct method

bool removeProduct(
  1. String productId
)

Removes a product from the cart using the productId.

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

Implementation

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