title: Flutter Bad State: No Element on a page where I have not added my element yet to it
body: <p>When my cart page is empty due to i havent add products to it, it gave this error, Bad State: No Element. I want to make it so that it say &quot;no products yet&quot; in the page when I go to this page. Im not sure how to integrate it into my code. I would like to add conditional statements but i dont know how to</p>
  <p>this is my cart_controller:</p>
  <pre><code>import 'package:grocery_shopping/models/product_model.dart';
  import 'package:get/get.dart';
  
  class CartController extends GetxController {
  
    var _products = {}.obs;
  
    void addProduct(Product product) {
      if (_products.containsKey(product)) {
        _products[product] += 1;
      } else {
        _products[product] = 1;
      }
  
      Get.snackbar(
        &quot;Product Added&quot;,
        &quot;You have added the ${product.name} to the cart&quot;,
        snackPosition: SnackPosition.BOTTOM,
        duration: Duration(seconds: 1),
      );
    }
  
    void removeProduct(Product product) {
      if (_products.containsKey(product) &amp;&amp; _products[product] == 1) {
        _products.removeWhere((key, value) =&gt; key == product);
      } else {
        _products[product] -= 1;
      }
    }
  
  
    get products =&gt; _products;
  
    get productSubtotal =&gt; _products.entries
        .map((product) =&gt; product.key.price * product.value)
        .toList();
  
    get total =&gt; _products.entries
        .map((product) =&gt; product.key.price * product.value)
        .toList()
        .reduce((value, element) =&gt; value + element)
        .toStringAsFixed(2);
  
  
  }
  </code></pre>