findItemIndexFromCart method Null safety

int? findItemIndexFromCart(
  1. dynamic cartId
)

Implementation

int? findItemIndexFromCart(cartId) {
  for (int i = 0; i < _cartItemList.length; i++) {
    if (_cartItemList[i].productId == cartId) {
      return i;
    }
  }
  return null;
}