[Flutter3] Json转dart模型举例

记录一下 Android studio plugin -> FlutterJsonBeanFactory 处理json转dart 模型

案例 json字符串, 一个 response的data返回数据

{"code":1,"msg":"\u64cd\u4f5c\u6210\u529f","data":{"list":{"id":"88","video":"","title":"NSCA \u5b98\u65b9\u52a8\u4f5c\u793a\u8303\u4e2d\u6587\u5b57\u5e55","duration":"600","lectures":"<p><br\/><\/p><p>NSCA\u7cfb\u5217\u8bfe\u7a0b\u7528\u6237\u9644\u8d60\uff0c\u6fc0\u6d3b\u8054\u7cfb\u5fae\u4fe1\uff1aNSCA001\u3002<\/p><p><br\/><\/p><p>\u8bf7\u5b66\u4e602-4\u904d\u3002<\/p><p><br\/><\/p><p>\u8bfe\u7a0b\u8bb2\u4e49\u548c\u601d\u7ef4\u5bfc\u56fe\u6253\u5361\u8fd4\u73b0\u6d3b\u52a8\uff0c\u641c\u7d22\u6dd8\u5b9d\u5e97\u94fa\uff1a\u56db\u5927\u8ba4\u8bc1\u5907\u8003\u795e\u5668\u3002<\/p><p><img src=\"https:\/\/cdn.froglesson.com\/diary\/170010249137156306.png\" alt=\"\u672c\u5730\u4e0a\u4f20\u56fe\u7247\" data-href=\"https%3A%2F%2Fcdn.froglesson.com%2Fdiary%2F170010249137156306.png\" style=\"max-width:100%;\" contenteditable=\"false\"\/><\/p><p><img src=\"https:\/\/cdn.froglesson.com\/diary\/170010250175061922.png\" alt=\"\u672c\u5730\u4e0a\u4f20\u56fe\u7247\" data-href=\"https%3A%2F%2Fcdn.froglesson.com%2Fdiary%2F170010250175061922.png\" style=\"max-width:100%;\" contenteditable=\"false\"\/><\/p><p><br\/><\/p><p><br\/><\/p><p><br\/><\/p><p><br\/><\/p><p><img src=\" https:\/\/cdn-image.froglesson.com\/attachment\/images\/4\/2021\/10\/TmQ3V3ZP19901w93P99Vf99p9V3M3m.jpg\" alt=\"\u8fd4\u73b0\u7ea2\u5305\u7ec4\u56fe.jpg\" style=\"max-width: 100%; -webkit-touch-callout: none; -webkit-user-select: none;\"\/><\/p><p><br\/><\/p><p>\u53ef\u80fd\u662f\u5168\u7f51\u6700\u706b\u7684NSCA\u5907\u8003\u8f6f\u4ef6\uff0c\u5907\u8003\u4eba\u90fd\u5728\u7528\u3002\u3010\u6570\u636e\u6765\u81ea\u5fae\u4fe1\u5f00\u53d1\u8005\u5e73\u53f0\uff0c\u622a\u6b62\u81f32024.01.06\u3011<\/p><p><br\/><\/p><p><br\/><\/p><p><img src=\"https:\/\/cdn.froglesson.com\/diary\/170446327227393414.jpg\" alt=\"\u672c\u5730\u4e0a\u4f20\u56fe\u7247\" data-href=\"https%3A%2F%2Fcdn.froglesson.com%2Fdiary%2F170446327227393414.jpg\" style=\"max-width:100%;\" contenteditable=\"false\"\/><\/p>","iostext":"zzmfit","is_give":"1","share_pic":"https:\/\/cdn.froglesson.com\/diary\/166807981495460473.jpg","type":"1","price":"594.00","bind_zsd":",294,","finishtitle":"\u8bfe\u7a0b\u53cd\u9988","finishtext":"\u5f88\u60f3\u77e5\u9053\u4f60\u5b66\u5f97\u5982\u4f55\u5462\uff0c\u8054\u7cfb\u8001\u5e08\u5fae\u4fe1\u53cd\u9988\u5662\uff5e","cn_list":[{"value":"[\"\u514d\u8d39\u5b9a\u671f\u66f4\u65b0\u5185\u5bb9\",\"\u968f\u65f6\u6253\u5f00\u5b66\u4e60\uff0c\u786e\u4fdd\u65f6\u6548\u6027\u548c\u76f8\u5173\u6027\"]"},{"value":"[\"\u4e13\u5c5e\u73ed\u7ea7\u7fa4\",\"\u4e3b\u8bb2\u8001\u5e08+\u52a9\u6559\u5b9e\u65f6\u7b54\u7591\uff0c\u91cd\u70b9\u5185\u5bb9\u5305\u6559\u5305\u4f1a\"]"},{"value":"[\"\u8bfe\u5916\u8d44\u6599\u5e93\",\"\u63d0\u4f9b\u989d\u5916\u7684\u5b66\u4e60\u6750\u6599\uff0c\u5982\u76f8\u5173\u6587\u7ae0\u3001\u89c6\u9891\u548c\u6a21\u677f\u7b49\uff0c\u4e0d\u6b62\u4e8e\u5907\u8003\"]"}],"isColl":1,"catalog":[{"id":"239","name":"\u89e3\u9501\u8054\u7cfbNSCA001","curriculum_id":"88","type":"1","video":"https:\/\/cdn-cert.froglesson.com\/cert\/video\/239.mp4","price":"0.00","duration":"00:22","img":null,"pid":"0","cover":null,"bind_zsd":null,"paper":[],"is_see":1.7273,"is_lock":1,"see_time":"21","video_lock":1},{"id":"314","name":"\u7206\u53d1\u529b\u8bad\u7ec3","curriculum_id":"88","type":"1","video":"https:\/\/cdn-cert.froglesson.com\/cert\/video\/314.mp4","price":"99.00","duration":"30:09","img":null,"pid":"0","cover":null,"bind_zsd":null,"paper":[],"is_see":2.3212,"is_lock":1,"see_time":"723","video_lock":1},{"id":"315","name":"\u4e0b\u80a2\u529b\u91cf\u8bad\u7ec3\u52a8\u4f5c","curriculum_id":"88","type":"1","video":"https:\/\/cdn-cert.froglesson.com\/diary\/1702108620423148.mp4","price":"99.00","duration":"35:17","img":"https:\/\/cdn-image.froglesson.com\/diary\/170210885758593405.jpeg","pid":"0","cover":null,"bind_zsd":null,"paper":[],"is_see":0,"is_lock":1,"see_time":0,"video_lock":1},{"id":"316","name":"\u4e0a\u80a2\u529b\u91cf\u8bad\u7ec31","curriculum_id":"88","type":"1","video":"https:\/\/cdn-cert.froglesson.com\/cert\/video\/316.mp4","price":"99.00","duration":"27:43","img":null,"pid":"0","cover":null,"bind_zsd":null,"paper":[],"is_see":0,"is_lock":1,"see_time":0,"video_lock":0},{"id":"317","name":"\u4e0a\u80a2\u529b\u91cf\u8bad\u7ec32","curriculum_id":"88","type":"1","video":"https:\/\/cdn-cert.froglesson.com\/cert\/video\/317.mp4","price":"99.00","duration":"14:09","img":null,"pid":"0","cover":null,"bind_zsd":null,"paper":[],"is_see":0,"is_lock":1,"see_time":0,"video_lock":0},{"id":"318","name":"\u4e0a\u80a2\u529b\u91cf\u8bad\u7ec33","curriculum_id":"88","type":"1","video":"https:\/\/cdn-cert.froglesson.com\/cert\/video\/318.mp4","price":"99.00","duration":"19:12","img":null,"pid":"0","cover":null,"bind_zsd":null,"paper":[],"is_see":0,"is_lock":1,"see_time":0,"video_lock":0},{"id":"319","name":"\u4e0a\u80a2\u529b\u91cf\u8bad\u7ec34","curriculum_id":"88","type":"1","video":"https:\/\/cdn-cert.froglesson.com\/cert\/video\/319.mp4","price":"99.00","duration":"27:31","img":null,"pid":"0","cover":null,"bind_zsd":null,"paper":[],"is_see":0,"is_lock":1,"see_time":0,"video_lock":0}],"shareInfo":[],"share_num":0,"isCert":0,"certId":0,"unlock":2,"examine":[],"kInfo":[{"id":"294","title":"\u5982\u4f55\u5224\u65ad\u8be5\u52a8\u4f5c\u6240\u5904\u7684\u89e3\u5256\u9762"}]}}}
  1. Android studio 安装插件即可

  2. 重启后, 右击选择生成数据

3.贴入数据, 这里,我们去掉 最外层的 code/msg /data. 仅对data内的 list数据进行处理即

4.数据获取


(Dio的简单封装记录在这)

相关推荐
大猫和小黄15 分钟前
Windows、CentOS环境下搭建自己的版本管理资料库:GitBlit
linux·服务器·windows·git
Schwertlilien36 分钟前
图像处理-Ch6-彩色图像处理
windows
糖朝1 小时前
c#读取json
c#·json
dingdingfish4 小时前
JSON 系列之2:JSON简单查询
oracle·json·database·19c·23ai
小奥超人5 小时前
PDF无法打印!怎么办?
windows·经验分享·pdf·办公技巧·pdf加密解密
gywl8 小时前
openEuler VM虚拟机操作(期末考试)
linux·服务器·网络·windows·http·centos
某柚啊9 小时前
Windows开启IIS后依然出现http error 503.the service is unavailable
windows·http
_oP_i9 小时前
HTTP 请求Media typetext/plain application/json text/json区别
网络协议·http·json
码农君莫笑10 小时前
信管通低代码信息管理系统应用平台
linux·数据库·windows·低代码·c#·.net·visual studio
蜜獾云12 小时前
linux firewalld 命令详解
linux·运维·服务器·网络·windows·网络安全·firewalld