title: Flutter: Check if key exist in list of [{"key": "value"}]
body: <p>Hi there 1month and still learning Dart/Flutter, Any way to check if &quot;key&quot; exists in [{&quot;key&quot;: &quot;value&quot;}]?
  I came from Javascript and python environment so I really have no idea what this thing called I just know it's a sort of list</p>
  <p>so here's my JSON</p>
  <pre><code>var example = [
    {
      &quot;name&quot;: &quot;Store1&quot;,
      &quot;products&quot;: []
    },
    {
      &quot;name&quot;: &quot;Store2&quot;,
      &quot;products&quot;: []
    },
    {
      &quot;name&quot;: &quot;Store3&quot;,
      &quot;products&quot;: []
    },
    {
      &quot;name&quot;: &quot;Store4&quot;,
      &quot;products&quot;: []
    }
  ]
  </code></pre>
  <p>So I'm trying to access it with like this</p>
  <pre><code>var organizedCart = [];
  for (var i = 0; i &lt; example.length; i++) {
    if (!organizedCart[0].contains(example[i]['name'])) {
      organizedCart.add(
        {
          &quot;name&quot;: &quot;${example[i]['name']}&quot;,
          &quot;products&quot;: [],
        },
      );
    }
  }
  </code></pre>
  <p>The goal of the condition is to avoid adding an existing &quot;name&quot;,
  So basically I want to add a {} inside a list if the organizedCart does not contain the condition given</p>
  <p>Thanks in advance!</p>
  <p><a href="https://dartpad.dev/9b0fc96bb64113cbdb1da34466abbbd1?" rel="nofollow noreferrer">demo</a></p>