setCartItemCount method

Future<void> setCartItemCount(
  1. int count
)

Sets cart item count.

The count should be greater than or equal to 0. We just use count to show or hide red indicator on the cart icon. If cound > 0, we will show the red indicator on the cart icon. Otherwise, we will hide the red indicator on the cart icon.

Implementation

Future<void> setCartItemCount(int count) async {
  if (!FWGlobalState.getInstance().sdkInitSucceeded) {
    await FWGlobalState.getInstance().sdkInitSucceededFuture;
  }
  final nativeMethodName = ShoppingNativeMethodName.setCartItemCount.name;
  FWMethodChannelUtil.getShoppingChannel().invokeMethod(
    nativeMethodName,
    count,
  );
}