【发布时间】:2020-09-24 17:43:59
【问题描述】:
这是我的代码 我想在flutter的下拉列表中放一个var
new DropdownButton<String>(
// value: selectedPurpose,
hint: new Text(
'Select visitng purpose',
style: TextStyle(fontFamily: "Gotham"),
),
items: widget.size
.map((purposeTemp) {
return new DropdownMenuItem<String>(
value: purposeTemp,
child: new Text(
purposeTemp,
style: TextStyle(fontFamily: "Gotham"),
),
);
}).toList(),
onChanged: (String purpose) {
setState(() {
ss = purpose.toString();
});
},
// value: selectedPurpose,
)
我收到此错误
type 'List<dynamic>' is not a subtype of type 'List<DropdownMenuItem<String>>'
我该怎么做才能解决它
【问题讨论】: