title: Google Dart Remove DropDown Duplicates
body: <p>I'm attempting to remove duplicates from a Map to populate a dropdown list.  However, I haven't been able to successfully remove them.  The dropdown fills with double the amount of data (JSON) than what actually exists.  If there is a simple way to do this, please let me know.  Also, please let me know if you need more information.</p>
  
  <p>Dart code:</p>
  
  <pre><code>var jsonString = response;
     //var dropDownValue = shroot.querySelector("#asset");
     SelectElement dropDown = shroot.querySelector("#asset");
  
     Map jsonObject = JSON.decode(jsonString) as Map;
         dropDownList = jsonObject["eee"] as List&lt;Map&gt;;
  
     LinkedHashMap&lt;String, Map&gt; dataMap = new LinkedHashMap&lt;String, Map&gt;();
  
     for(Map d in dropDownList)
      {
        dropDown.children.add(new OptionElement(data: d['displayName'], value: d['displayName']));
  
        print(d);
        print(d["id"]);
        print(d["displayName"]);
      }
  </code></pre>
  
  <p>Dart Attempt 2:</p>
  
  <pre><code>var ddValues = dropDownList
       // extract the 'displayValue'
       .map((e) =&gt; e['displayName'])
       // create a set to eliminate duplicates
       .toSet().toList()
       // sort the result 
       // sort changes the list it is called - it doesn't return a new list
       // therefore we have to chain it using `..` instead of `.`
       ..sort();
  
       ddValues.forEach((e) {
         print(e);
        dropDown.children.add(new OptionElement(data: e, value: e));
       });
  </code></pre>