main function
dynamic
main()
Implementation
main() {
var result = {};
citysData.forEach((k, v) {
result[k] = {};
Map temp = v;
temp.forEach((k2, v2) {
result[k][k2] = {
'name': v2,
'alpha': PinyinHelper.getFirstWordPinyin(v2)[0],
};
});
});
final filename = 'file.txt';
new File(filename).writeAsString(jsonEncode(result)).then((File file) {
// Do something with the file.
});
}