cleanTagsFromRichtext static method Null safety

String cleanTagsFromRichtext(
  1. String text
)

remove all tags from a HTML-Richtext and return the raw, unformatted text

Implementation

static String cleanTagsFromRichtext(String text) {
  RegExpMatch? match = RegExProvider.tagRegex.firstMatch(text);

  while (match != null) {
    text = text.substring(0, match.start) + text.substring(match.end);
    match = RegExProvider.tagRegex.firstMatch(text);
  }

  return text;
}