escapeHtml function
Escapes & < > " ' for text and attribute values.
Implementation
String escapeHtml(String value) {
final out = StringBuffer();
for (final unit in value.runes) {
out.write(switch (unit) {
0x26 => '&',
0x3C => '<',
0x3E => '>',
0x22 => '"',
0x27 => ''',
_ => String.fromCharCode(unit),
});
}
return out.toString();
}