stripHtml property
String?
stripHtml
Strips all HTML code from String.
Example
String html = '<script>Hacky hacky.</script> <p>Here is some text. <span class="bold">This is bold. </span></p>';
String stripped = foo.stripHtml; // returns 'Hacky hacky. Here is some text. This is bold.';
Implementation
String? get stripHtml {
if (this == null) return null;
if (this!.isEmpty) return this;
final regex = RegExp('<[^>]*>');
return this!.replaceAll(regex, '');
}