I’ve been trying to achieve this for a while, I have a string which contains a lot of HTML tags in it which is in some encoded form Like & lt; and & gt; (without th
By just using
import ‘package:html/parser.dart’;
will get a problem, for those strings that includes and tags. Paragraph info is missing. May first replace to , then get List:
import ‘package:html/parser.dart’ as dom;
htmlString = ' first ... line.
second.....line.
';
List cleanStrings = new List();
List ps = parse(htmlString.replaceAll('
', '
'))).querySelectorAll('p');
if (ps.isNotEmpty) ps.forEach((f) {
(f.text != '') cleanStrings.add(f.text);
});