我需要在方法中接收一个字符串并将其更改为Map,然后我尝试了
(Map map = json.decode(s);)并不断出错
void populateModel(String s) {
print(s);
Map map=s as Map;
for (String key in map.keys) {
menuitems.add(DropdownMenuItem<String>(
value: map[key],
child: Center(enter code here
child: Text(map[key]),
),
));
}
}