flutter解析本地json数组

不啰嗦上代码:

body:FutureBuilder(
        future: DefaultAssetBundle.
        of(context).
        loadString('files/sys_area.json'),
        builder: (context,snapshot){
          // ignore: deprecated_member_use
          List responseJson = json.decode(snapshot.data.toString());
          addressList = responseJson.map((m) => new AddressBean.fromJson(m)).toList();
          print("here is list size==> ${addressList.length}");
          return _buildView();
          },
      ),

 


版权声明:本文为u014465652原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。