Created
January 2, 2020 23:50
-
-
Save VB10/fd560694fec0a38751e798a213408001 to your computer and use it in GitHub Desktop.
Flutter dropdown Error: Either zero or 2 or more [DropdownMenuItem]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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