title: How to filter list in flutter?
body: <p>I'm trying to add a filter to my <code>list</code></p>
  
  <p>here is what i do </p>
  
  <pre><code>productTemp.sort((a, b) =&gt; b.productPrice.compareTo(a.productPrice));
          productTemp = productTemp.where((x) =&gt;
              x.productName.toLowerCase().contains(inputText.toLowerCase()));
          productTemp = productTemp.toSet().toList();
  </code></pre>
  
  <p>here how i set it up </p>
  
  <pre><code>List&lt;ProductsModel&gt; productTemp = [];
  </code></pre>
  
  <p>then this</p>
  
  <pre><code>class ProductsModel {
    final String productId;
    final String productName;
    final String isNew;
    final String isHot;
    final String productImage;
    final String categoryId;
    final String productPrice;
    final String productDescription;
  
    ProductsModel(
        {this.productId,
        this.productName,
        this.isNew,
        this.isHot,
        this.productImage,
        this.categoryId,
        this.productPrice,
        this.productDescription});
  
    factory ProductsModel.fromJson(Map&lt;String, dynamic&gt; json) {
      return ProductsModel(
        productId: json['productId'] as String,
        productName: json['productName'] as String,
        isNew: json['isNew'] as String,
        isHot: json['isHot'] as String,
        productImage: json['productImage'] as String,
        categoryId: json['categoryId'] as String,
        productPrice: json['productPrice'] as String,
        productDescription: json['productDescription'] as String,
      );
    }
  
    bool operator ==(o) =&gt;
        o is ProductsModel &amp;&amp; productId == o.productId;
  
    int get hashCode =&gt; productId.hashCode;
  }
  </code></pre>
  
  <p>so i get this error </p>
  
  <blockquote>
    <p>[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: type
    'WhereIterable' is not a subtype of type
    'List'</p>
  </blockquote>
  
  <p>how can i fix it ? thanks in advance</p>