Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1029

Dart Json UTF-8 Decode

$
0
0

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))

And it's look like enter image description here


Viewing all articles
Browse latest Browse all 1029

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>