【发布时间】:2020-05-30 19:24:27
【问题描述】:
我将这个file 复制到我的本地并尝试解析它。 以下是我心中的问题:
- 1) 如何为列表视图解析类别 [运动、数学]/
- 2)如何解析category里面的item?
- 3) 是否需要更改json的格式才能有更简单的代码?
目前,这是代码
Future<dynamic> _future;
Future<String> _getJson() async {
var response = await rootBundle.loadString('assets/example_2.json');
var decodedJason = json.decode(response);
return (decodedJason); }
void initState() {
_future = _getJson();
super.initState(); }
提前致谢
【问题讨论】:
-
你应该检查下面的链接developerlibs.com/2018/11/…