flutter parses local json array

 Parse the following code: If you don’t know how to add local json, you can read my other article flutter parsing local json

    rootBundle.loadString("images/list.json").then((value){
      //将json转成list数据
      List responseJson = json.decode(value);
      //将数组循环解析,得到解析后的数组
      var list = responseJson.map((m) =>  ListBean.fromJson(m)).toList();
    });

Guess you like

Origin blog.csdn.net/hzqit520/article/details/123372389