flutter小知识flutter_JSON序列化 json_encode是将数值转换成json格式,json_decode()函数将json数据转换成数组 要序列化一个ServiceInfoModel ,我们只是将该ServiceInfoModel 对象传递给该JSON.encode方法。我们不需要手动调用toJson这个方法,因为JSON.encode已经为我们做了。 1234567891011121314151617181920class User { User(this.id, this.name); int id; String name;//jsonDecode(sting) ->就是fromJson过程 转成结果为map User.fromJson(Map<String, dynamic> json) { id = json['id']; name = json['name']; }//jsonEncode(user) ->就是tojson过程 Map<String, ...