I am using below DropDownField
code to for countries listing, But I am not able to store the value in the String selectedValue
. I am using DropDownField
dependency in flutter.
List<String> countries = [
'FRANCE',
'USA',
'JAPAN',
];
String selectedValue;
DropDownField( icon: Icon(Icons.map),
required: false,
hintText: 'Choose a country',
labelText: 'Country',
items: countries,
setter: (dynamic newValue) {
setState(() {
selectedValue = newValue;
});
}),
You should use onChanged to get value from DropDown.
DropDownField( icon: Icon(Icons.map),
required: false,
hintText: 'Choose a country',
labelText: 'Country',
items: countries,
onChanged:(value){
print(value)
}
}),