I'm making a postDetails page in Flutter and I've written a function that will list the comments for that post. It pulls data from database correctly (I'm debugging) but FormatException (FormatException: Unexpected character (in char 1) It gives error. işte kodum;
Future<void> getComments() async {
var url = Uri.parse("http://172.30.182.148/uploads/getComments.php");
var response = await http.post(url, body: {"post_id": widget.id});
if (response.statusCode == 200) {
var data = jsonDecode(response.body);
setState(() {
comments = List<String>.from(data['comment']);
});
} else {
Fluttertoast.showToast(msg: "Yorumlar alınamadı");
}
}