Im trying to display a string with emojis on a text widget. The string is encoded using utf8. My question is how can I decode the whole string so it will display to the text properly?
here is the string with emojis:
Testing emoticons post \ud83d\ude18\ud83d\udc4c\ud83e\udd70\ud83d\ude02\ud83e\udd73\u2708\ufe0f\ud83d\udc4a\ud83d\ude01\ud83d\ude01\ud83e\udd23\ud83d\ude04\ud83d\ude01\u2708\ufe0f\ud83d\ude01\ud83d\ude0d\ud83d\ude4f\ud83e\udd22\ud83d\ude2d
Currently I have this function :
String utf8convert(String text) {
List<int> bytes = text.toString().codeUnits;
return utf8.decode(bytes);
}
If you are using API to get data with emojis.
final response =
await _httpClient.get(uri);
jsonDecode(utf8.decode(response.bodyBytes))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With