I need to decode the data I receive as utf8. The codes are like this
Future<Products> Get Product() async { var response = await http.get(url); var decodedJson = json.decode(response.body); products = Products.fromJson(decodedJson); return products; }
I tried the solutions I saw. One of them told me to do it like this
var response = await http.get(url,headers: {'Content-Type': 'application/json'}); var decodedJson = json.decode(utf8.decode(response.bodyBytes));
When I do this, I get the following
errorException has occurred.
FormatException (FormatException: Missing extension byte (at offset 554))