说明如何与Dart HtmlE罪羊阶级打交道。
const HtmlEscape htmlEscape = HtmlEscape();
String unescaped = Text & subject ; // The text you want to convert
String escaped = htmlEscape.convert(unescaped);
print(escaped); // Text & subject
Using flutter_html to preview with HTML template.
import package:html/parser.dart as htmlparser;
import package:html/dom.dart as dom;
...
String htmlData = """<div>
<h1>Demo Page</h1>
<p>This is a fantastic product that you should buy!</p>
<h3>Features</h3>
<ul>
<li>It actually works</li>
<li>It exists</li>
<li>It doesn t cost much!</li>
</ul>
<!--You can pretty much put any html in here!-->
</div>""";
dom.Document document = htmlparser.parse(htmlData);
/// sanitize or query document here
Widget html = Html(
document: document,
);