title: Flutter - Default value in dropdown
body: <p>I'm trying to send a element to one view. This element will be default element in the dropdown of the second page . I use something like that in first page</p>
  
  <pre><code>  onTap: () {
                          Navigator.push(
                              context,
                              new MaterialPageRoute(
                                  builder: (context) =&gt; new SummaryPage(,
                                      dropdownItem: dropdownSelection)));
                        } 
  </code></pre>
  
  <p>Then in page two i create future to get all elements in dropdown and initstate method to set default element dropdown   </p>
  
  <pre><code> List data = List();
  
   Future&lt;Null&gt; getEstates() async {
      final response = await http
          .get('URL'
      }).catchError((error) {
        print(error.toString());
      });
      final responseJson = json.decode(response.body);
      final getBody = responseJson['body'];
      setState(() {
        data = getBody;
        loading = false;
      });
    }
  
  
   void initState() {
      super.initState();     
  
       setState(() {
            dropdownSelection = widget.dropdownItem.toString();
          });
  </code></pre>
  
  <p>getEstate return this</p>
  
  <blockquote>
    <p>[{id: 1, descripcion: Terreno Rio}, {id: 2, descripcion: Terreno
    Asier}]</p>
  </blockquote>
  
  <p>The dropdown look like similar to this</p>
  
  <pre><code>child: ButtonTheme(
                      alignedDropdown: true,
                      child: new DropdownButton&lt;String&gt;(
                        isDense: true,
                        hint: new Text("Search...",
                            textAlign: TextAlign.center),
                        value: dropdownSelection,
                        onChanged: (String newValue) {
                          setState(() {
                            dropdownSelection = newValue;
                        },
                        items: data.map((item) {
                          return new DropdownMenuItem&lt;String&gt;(
                            child: new Text(
                              item['description'],
                            ),
                            value: item['id'].toString(),
                          );
                        }).toList(),
                      ),
                    ),
  </code></pre>
  
  <p>The error that shows is</p>
  
  <blockquote>
    <p>value == null || items.where((DropdownMenuItem item) => item.value
    == value).length == 1': is not true</p>
  </blockquote>
  
  <p>Apparently code is fine but when i go to the second view shows a error view around 1 seconds and then show the second page. I think the value maybe load too soon and dropdown can´t set properly. Any idea why this error happens and how can i fix them?</p>