DEV Community

Satya Routray
Satya Routray

Posted on

Answer: Remove HTML tags from a String in Dart

You can simply use RegExp without 3rd Lib for remove tag (

</>)

String removeAllHtmlTags(String htmlText) {
    RegExp exp = RegExp(
      r"<[^>]*>",
      multiLine: true,
      caseSensitive: true
    );

    return htmlText.replaceAll(exp, '');
  }

Top comments (0)