list - 如何将 json 映射转换为列表字符串?

标签 list dart flutter

我需要将国家名称和国家代码作为“Andorra (AD)”输入到列表中。我可以将 json 加载到 map ,但无法转换为列表。如何将 json 映射转换为列表字符串?

“国家”:[ { "国家代码": "AD", "countryName": "安道尔", “货币代码”:“欧元”, “等值”:“020” },

最佳答案

你可以使用.map()函数

var countryList = country.map((c) => '${c["countryName"]} (${c["countryCode"]})').toList()

关于list - 如何将 json 映射转换为列表字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54287463/

相关文章:

java - 将文件读入列表?

python - Python 中的列表按引用传递混淆

flutter - CachedNetworkImage 图像不改变同名

html - 我可以自动序列化 Dart 对象以通过 Web Socket 发送吗?

python - 将 Python 列表转换为有序的唯一值

python : update value in nested dictonary after reading keys from list

flutter - 是否可以在Flutter上使用SVG动画?

android - 如何正确限制对 Android 和 iOS 应用程序(用 Flutter 编写)的 Google map (地点、地理编码)API 调用?

android - 如何改变单选按钮的半径

flutter - 去除底部导航栏 flutter 中的底部阴影效果