toHtmlText method

String toHtmlText()

Escapes HTML special characters (<, >, &, ", ').

Implementation

String toHtmlText() => replaceAll('&', '&amp;')
    .replaceAll('<', '&lt;')
    .replaceAll('>', '&gt;')
    .replaceAll('"', '&quot;')
    .replaceAll("'", '&#39;');