title: Flutter populate dropdownmenu with JSON
body: <p>I am trying to take JSON returned from rest api and populate a dropdownmenu, I need to have the value different from the child value.  Has anyone done this or have an example or advice.  I am using the basic example and can not seem to find a way to use JSON instead of static list. Below is what I have tried and it still does not find the value.  I keep getting a dart null error.  Any help would be great. I have updated with how I get the JSON and decode.  I have tried several things. This is the error as well, but I have confirmed in debug that the value is never null, so it has to be something with the JSON.  I have tried with a static list and it works.</p>
  
  <pre><code>'package:flutter/src/material/dropdown.dart': Failed assertion: line 433 pos 15: 'value == null
  
  String _referPractice = '&lt;New&gt;';
  </code></pre>
  
  <p>JSON looks like this:</p>
  
  <pre><code>[{"id":0,"name":"&lt;New&gt;"},{"id":1,"name":"Test Practice"}]
  
  
  var http = createHttpClient();
  var response = await http.get(_url);
  var practices = await jsonCodec.decode(response.body);
  practicelist = await practices.toList();
  
  new DropdownButton&lt;String&gt;(
          value: _referPractice,
          isDense: true,
          onChanged: (String newValue) {
            setState(() {
              _referPractice = newValue;
            });
          },
          items: practicelist.map((value) {
            return new DropdownMenuItem&lt;String&gt;(
              value: value['id'].toString(),
              child: new Text(value['name']),
            );
          }).toList(),
        ),
  </code></pre>