问题描述
Future<dynamic> fetchNews(String lid, String realsize) async {
String url = "http://192.168.55.101:8000/todo";
final response =
await http.get(Uri.parse(url),
headers: <String, String>{
// "Content_Type" : "application/x-protobuf"
},
);
if (response.statusCode == 200) {
whatNewsMsg data = whatNewsMsg.fromJson(json.decode(response.body.toString()));
print("data: " + data.title); // ====> Here I get error
return response.body.toString();
} else {
throw Exception('Unable to fetch news from the REST API');
}
}
标签: flutterapidartprotocol-buffers
解决方案
推荐阅读