title: Flutter: Show different icons based on value
body: <p>I have a list of objects each with an icon property as shown here:</p>
  
  <pre><code>List&lt;Map&lt;String, String&gt;&gt; _categories = [
      {
        'name': 'Sports',
        'icon': 'directions_run',
      },
      {
        'name': 'Politics',
        'icon': 'gavel',
      },
      {
        'name': 'Science',
        'icon': 'wb_sunny',
      },
  ];
  </code></pre>
  
  <p>I then have a widget that I am using inside of a ListView.builder() widget. Currently I am displaying a statically chosen icon to show with the text in my list. My question is how can I use the icon property in my objects to dynamically pick the icon that gets shown for each individual list item?</p>
  
  <pre><code>  Widget _buildCategoryCards(BuildContext context, int index) {
      return Container(
        padding: EdgeInsets.symmetric(vertical: 5.0),
        child: Card(
          child: Container(
            padding: EdgeInsets.all(15.0),
            child: Row(
              children: &lt;Widget&gt;[
                Icon(Icons.directions_run),
                SizedBox(width: 20.0),
                Text(_categories[index]['name']),
              ],
            ),
          ),
        ),
      );
    }
  </code></pre>