updateCartItem method

  1. @override
Future<bool> updateCartItem(
  1. String itemId,
  2. int quantity
)
override

Update cart item quantity.

Updates the quantity of a specific item in the shopping cart.

itemId the ID of the cart item to update quantity the new quantity (0 will remove the item)

Returns true if quantity was updated successfully, false otherwise.

Implementation

@override
Future<bool> updateCartItem(String itemId, int quantity) async {
  try {
    final result = await methodChannel.invokeMethod<bool>('updateCartItem', {
      'itemId': itemId,
      'quantity': quantity,
    });
    return result ?? false;
  } catch (e) {
    _error = e.toString();
    return false;
  }
}