Flutter JSON字符串和Map类型的转换
一、Flutter Map转换成Json
import 'dart:convert'
Map userInfo={
"username":"张三",
"age":20
};
print(json.encode(userInfo));
二、36.1.2、Flutter Json转换成Map
String str='{"username":"张三","age":20}';
print(json.decode(str));
Map info=json.decode(str);
print(info["username"]);