title: Flutter/Dart: How to get list value where key equals
body: <p>I'm not sure why I'm having such a hard time finding an answer for this, but I have a list that I need to get the value from where the key matches certain criteria. The keys are all unique. In the example below, I want to get the <code>color</code> where the <code>name</code> equals "headache". Result should be "4294930176".</p>
  
  <pre><code>//Example list
  String trendName = 'headache';
  List trendsList = [{name: fatigue, color: 4284513675}, {name: headache, color: 4294930176}];
  
  //What I'm trying
  int trendIndex = trendsList.indexWhere((f) =&gt; f.name == trendName);
  Color trendColor = Color(int.parse(trendsList[trendIndex].color));
  print(trendColor);
  </code></pre>
  
  <p>Error I get: Class '_InternalLinkedHashMap' has no instance getter 'name'. Any suggestions?</p>
  
  <p>EDIT:
  Here's how I'm adding the data to the list, where userDocuments is taken from a Firestore collection:</p>
  
  <pre><code>for (int i = 0; i &lt; userDocument.length; i++) {
    var trendColorMap = {
       'name': userDocument[i]['name'],
       'color': userDocument[i]['color'].toString(),
    };
    trendsList.add(trendColorMap);
  }
  </code></pre>