I am trying to implement a simple DropdownButton with which the user can select a currency.
Container(
height: 150.0,
alignment: Alignment.center,
padding: EdgeInsets.only(bottom: 30.0),
color: Colors.lightBlue,
child: DropdownButton<String>(
items: [
DropdownMenuItem(child: Text('USD')),
DropdownMenuItem(child: Text('EUR')),
DropdownMenuItem(child: Text('GBP')),
],
value: 'USD',
onChanged: (value) {
print(value);
},
),
),
But i am getting below error
Failed assertion: line 620 pos 15: 'items == null || items.isEmpty || value == null || items.where((DropdownMenuItem<T> item) => item.value == value).length == 1': is not true.
How to overcome this error? Thanks in advance