I' m gettings items from JSON and displaying them in a dropdown. When the person select an item from the dropdown list, I get the selection but the selected item doesn't change.
For example we have (tokyo, paris, new york) in the list. By default selection is tokyo. When the person select paris, I get it but the selection doesn't change in the dropdown.
Here is my code:
new DropdownButton(
value: cities.elementAt(0),
hint: new Text("Ville"),
items: cities.map((String value) {
return new DropdownMenuItem(
value: value,
child: new Row(
children: <Widget>[
new Icon(
Icons.location_city,
color: Colors.deepOrange,
),
new Text(value)
],
),
);
}).toList(),
onChanged: (String value) {
getTravelCity(value);
},
),
When the person select an item, it still showing the default value.