Future<void> _getShopListAllJson() async {
try {
final response = await http.get("http://abair.gq/db_dept_info_all.php");
if (response.statusCode == 200) {
print(response.statusCode);
print(response.body);
setState(() {
_data = jsonDecode(response.body) as List;
});
} else {
print("Some error: ${response.statusCode}");
}
} catch (e) {
print(e);
}
}
Please see above code flutter web api calling error xmlhttprequest