报错如下:
======== Exception caught by widgets library =======================================================
The following NoSuchMethodError was thrown building FutureBuilder<String>(dirty, state: _FutureBuilderState<String>#c8610):
'[]'
Dynamic call of null.
Receiver: null
Arguments: ["count"]
用的是FutureBuilder来获取数据
class ToBeReadPageState extends State<ToBeReadPage> {
@override
Widget build(BuildContext context) {
return FutureBuilder<String> (
future: DefaultAssetBundle.of(context).loadString("jsons/toberead.json"),
builder: (BuildContext context, AsyncSnapshot snapshot) {
var map = json.decode(snapshot.data.toString());
List _animes = map["data"];
print(_animes.map((e) => e["DJSJ"]).toList());
if (snapshot.connectionState != ConnectionState.done) {
return HomeNoDataPage();
}
return ListView(children:
_animes
.map((e) => HomeCard(hTitle: e['YWMS'], hContent: e['YWMS'], hName: e['YHNMXM'], hTime: e['DJSJ']))
.toList(),
);
},
);
}
}