sanitizeHtml function
Removes script and style tag contents, then strips all HTML tags.
Implementation
String sanitizeHtml(String html) {
String s = html.replaceAllMapped(
RegExp(r'<script[^>]*>[\s\S]*?</script>', caseSensitive: false),
(_) => '',
);
s = s.replaceAllMapped(RegExp(r'<style[^>]*>[\s\S]*?</style>', caseSensitive: false), (_) => '');
return stripHtmlTags(s);
}