Skip to content

Instantly share code, notes, and snippets.

@VB10
Created January 2, 2020 23:50
Show Gist options
  • Save VB10/fd560694fec0a38751e798a213408001 to your computer and use it in GitHub Desktop.
Save VB10/fd560694fec0a38751e798a213408001 to your computer and use it in GitHub Desktop.
Flutter dropdown Error: Either zero or 2 or more [DropdownMenuItem]
Widget dropdownWidget(InputDecoration decoration) {
var _value = itemList.isEmpty
? value
: itemList.firstWhere((item) => item.value == value.value);
return DropdownButtonFormField<DropdownItem>(
decoration: decoration,
hint: hint != null ? Text(hint) : null,
items: _itemList,
value: _value,
onChanged: onChange);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment