Document parse(input, {String encoding, bool generateSpans: false, String sourceUrl})

Parse the input html5 document into a tree. The input can be a String, List of bytes or an HtmlTokenizer.

If input is not a HtmlTokenizer, you can optionally specify the file's encoding, which must be a string. If specified that encoding will be used regardless of any BOM or later declaration (such as in a meta element).

Set generateSpans if you want to generate SourceSpans, otherwise the Node.sourceSpan property will be null. When using generateSpans you can additionally pass sourceUrl to indicate where the input was extracted from.

Source Link to Crossdart

Document parse(input,
    {String encoding, bool generateSpans: false, String sourceUrl}) {
  var p = new HtmlParser(input,
      encoding: encoding, generateSpans: generateSpans, sourceUrl: sourceUrl);
  return p.parse();
}