问题:There should be exactly one item with [DropdownButton]'s value: Instance of 'EnumValue'.
Either zero or 2 or more [DropdownMenuItem]s were detected with the same value
今天在for循环里添加了 DropdownButton,报了上述错误,
解决办法,在对自己定义的象类(如EnumValue)里添加
bool operator ==(dynamic other) =>
other != null && other is EnumValue && this.key == other.key;//key是EnumValue对象的一个属性
@override
int get hashCode => super.hashCode;
参考