title: Implement multiple filters using Flutter and Dart
body: <p>I have a list lets's say 'ProductList'</p>
  <p>I have a filter bar with tiltes 'Color' and 'Shape' with toggle buttons Red, green, square and round.</p>
  <p>Color:
  Red     Green</p>
  <p>Shape:
  Square  Round</p>
  <p><strong>1st category - Color</strong></p>
  <p>If I click red, the 'ProductList' must be filtered for Red color.</p>
  <p><code>firstFilteredList = ProductList.where((p) =&gt; p.color == &quot;red&quot;);</code></p>
  <p>Now if I click green, the 'ProductList' must be filtered for Red and Green color.</p>
  <p><code>firstFilteredList = ProductList.where((p) =&gt; p.color == &quot;red&quot; || p.color == &quot;green&quot;);</code></p>
  <p><strong>2st category - Shape</strong></p>
  <p>Now if I click square, the 'firstFilteredList' must be filtered for square shape.</p>
  <p><code>secondFilteredList = firstFilteredList.where((p) =&gt; p.shape == &quot;square&quot;);</code></p>
  <p>Now if I click round, the 'firstFilteredList' must be filtered for square and round shape.</p>
  <p><code>secondFilteredList = firstFilteredList.where((p) =&gt; p.shape == &quot;square&quot; || p.shape == &quot;round&quot;);</code></p>
  <p>I need to remove those filters if the button is toggled off.</p>
  <p>I've just mentioned two filter categories - Color and shape, for the sake of simplicity. There may be 6-7 filter categories. So, the solution has to be scalable.</p>
  <p>Can someone help me solve this?</p>
  <p>Edit:
  ProductList is a element of CategorizedProduct. I have to return List.</p>
  <pre><code>class CategorizedProduct {
    String id;
    String title;
    List&lt;Product&gt; product;
    String selectedVariant;
  }
  
  class Product {
    String color;
    String id;
    bool shapeRectangle;
    bool shapeRound;
    bool shapeSquare;
  }
  </code></pre>