title: How can I find the length of an item from a list based on its id in Flutter?
body: <p>I got a list List product=[];</p>
  <p>product=await dbHelper.getProducts();</p>
  <p>I was trying to build a cart with sqflite, I get a list such that the same product shows in different list tile, here's my code,</p>
  <pre><code> product={[{ &quot;product name&quot; : &quot;apple&quot;, &quot;product id&quot; : &quot;1&quot;, &quot;quantity&quot; : &quot;2&quot;,},{ &quot;product name&quot; : &quot;apple&quot;, &quot;product id&quot; : &quot;1&quot;, &quot;quantity&quot; : &quot;5&quot;,},{ &quot;product name&quot; : &quot;orange&quot;, &quot;product id&quot; : &quot;2&quot;, &quot;quantity&quot; : &quot;10&quot;,}]}
  
  ListView.builder(
            itemCount: product.length,
              itemBuilder: (c,i){
              return ListTile(
                title:Text(product[i].product_varient_name.toString()),
                subtitle: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text(product[i].base_price),
                    Text(&quot;qty : &quot;+product[i].varient_id),
                    Container(
                        height: 80,width: 80,
                        child: Image.network(&quot;https://v.3multi.qgrocer.in/public/&quot; +product[i].varient_image.toString())),
  
                  ],
                ),
              );
              }),
  </code></pre>
  <p>Output is,</p>
  <pre><code>01   Apple  5
  02   Apple  2
  03   orange 1
  ...
  </code></pre>