Michael Cruden
 · Seamless Technology Integration

How do I display html escaped strings as plain text?

I am pulling data from a Wordpress API (WP-JSON) which encoded the html in the title string. I want to show the string with the escaped characters shown as basic text. I would use the HTMLView widget but I can't figure out how to style the output. If I could control the color of that output, that would sort things out for me as well.

Current output: Text & subject
Desired output: Text & subject

Basically the opposite of what this function is doing:
https://api.dart.dev/stable/3.2.3/dart-convert/HtmlEscape-class.html

const HtmlEscape htmlEscape = HtmlEscape();
String unescaped = 'Text & subject';
String escaped = htmlEscape.convert(unescaped);
print(escaped); // Text & subject

10 replies