为什么这段代码给我这个错误?如何解决?
错误:“ [[ERROR:flutter / lib / ui / ui_dart_state.cc(148)]未处理的异常:FormatException:意外的字符(在字符1)”
这是我的json
[{“ id”:1,“ title”:“ title”,“ message”:“ content”,“ isSent”:true,“ datePublished”:“” 2019-05-13T15:06:40 + 02: 00“,” messageType“:1,” dateExpired“:” 2019-05-13T15:06:40 + 02:00“,” imageUrl“:” http:///img/admin/login.jpg“},{ “ id”:2,“ title”:“ Tytu \ u0142 test”,“ message”:“是”,“ isSent”:true,“ datePublished”:“” 2019-05-13T15:11:12 + 02:00“ ,“ messageType”:1,“ dateExpired”:“ 2019-05-13T15:11:12 + 02:00”,“ imageUrl”:“ http:///img/admin/login.jpg”}]
final response = await http.get("http:/abc/posts/get");
if (response.statusCode == 200) {
list = json.decode(response.body) as List;
firstList = json.decode(response.body) as List;
setState(() {
isLoading = false;
});
} else {
Toast.show('Failed to load data', context);
throw Exception('Failed to load data');
}