title: How to show the name of chosen element in dropdownmenu working with object?
body: <p>In this code I am trying to show list of Locations in a drop down menu. In here,I am working with a location model that consists of both name and uid. It works. However, I am not able to show the selected option to the user.
  the object here for me is the Location( this.name, this.uid).</p>
  
  <pre><code>class DropButt extends StatelessWidget {
    DropButt({Key key,this.locations,this.onchange});
    // final String _selectedLocation='';
    final List&lt;Location&gt; locations;  
    Function(Location) onchange;
  
    @override
    Widget build(BuildContext context) {
    return DropdownButton&lt;Location&gt;(
      //value:, here I donot know which value Should I put when I come to put //name it didnot accept it as dropdownbutton is of type location
  
            items: locations.map((Location val) {
                     return new DropdownMenuItem&lt;Location&gt;(
                          value: val,
                          child: new Text(val.name),
                           );
                      }).toList(),
                      onChanged:(_){ 
                        onchange(_);
                        //here I will sink to the ream the value of th choosen location
                      },
                    );}
  
  }
  </code></pre>