encodeHtml function

String encodeHtml(
  1. String str, [
  2. bool preventDoubleEncoding = true
])

Implementation

String encodeHtml(String str, [bool preventDoubleEncoding = true]) {
  if (preventDoubleEncoding) {
    str = decodeHtml(str);
  }

  return HtmlEscape(HtmlEscapeMode(
    escapeApos: true,
    escapeLtGt: true,
    escapeQuot: true,
    escapeSlash: true,
  )).convert(str);
}