html_parser 0.6.0

  • Installing
  • Versions
  • 35


Build Status Pub

A fast and forgiving HTML parser for Dart. Loosely based on htmlparser2.

This package is in development as an experiment to replace the transpiled HTML parser from angular_2. It is not meant to be a full DOM parser, or to emulate behavior of the browser - for that see package:html.

Goals are speed, ease of use, and great error messages.


import 'package:html_parser/html_parser.dart';

void main() {
  var fragment = parseHtml('<div>Hello World</div>');

  // Prints: '<div>Hello World</div>'


Some things missing from making this a package ready to use for all:

See issues for more details and to contribute!



  • Exported Attribute and Comment nodes as part of the public API
  • Exported HtmlVisitor and PrinterHtmlVisitor
  • Added .fromToken(s) APIs for some of the Element ASTs (internal use)

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  html_parser: "^0.6.0"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

      import 'package:html_parser/html_parser.dart';
Version Uploaded Documentation Archive
0.6.0 Oct 10, 2016 Go to the documentation of html_parser 0.6.0 Download html_parser 0.6.0 archive
0.5.0 Oct 8, 2016 Go to the documentation of html_parser 0.5.0 Download html_parser 0.5.0 archive
0.4.0 Oct 2, 2016 Go to the documentation of html_parser 0.4.0 Download html_parser 0.4.0 archive
0.2.0 Oct 1, 2016 Go to the documentation of html_parser 0.2.0 Download html_parser 0.2.0 archive
0.1.1 Oct 1, 2016 Go to the documentation of html_parser 0.1.1 Download html_parser 0.1.1 archive
0.1.0+dev Oct 1, 2016 Go to the documentation of html_parser 0.1.0+dev Download html_parser 0.1.0+dev archive


We analyzed this package on Jun 19, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3


Describes how popular the package is relative to other packages. [more]
0 / 100
Code health derived from static analysis. [more]
96 / 100
Reflects how tidy and up-to-date the package is. [more]
30 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:html_parser/html_parser.dart.


  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 error 3 hints.

    Strong-mode analysis of lib/src/visitor.dart failed with the following error:

    line: 75 col: 12
    The expression in an assert must be of type 'bool'.

    Run dartfmt to format lib/src/nodes/attribute_node.dart.

    Similar analysis of the following files failed:

    • lib/src/nodes/element_node.dart (hint)
  • Package is getting outdated.

    The package was released 88 weeks ago.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use html_parser.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0
charcode >=1.1.0 <2.0.0 1.1.1
collection ^1.0.0 1.14.10
string_scanner ^1.0.0 1.0.2
Transitive dependencies
path 1.6.1
source_span 1.4.0
Dev dependencies