PageData constructor

PageData(
  1. String url,
  2. String html, {
  3. String? jsonData,
  4. String? defaultJsonId,
})

parse the html into object's document. object's jsonData first come from the parameter's jsonData and decode it into json object. if defaultJsonId is not null then get data from document that has id named defaultJsonId, otherwise set to null

Implementation

PageData(this.url, this.html,
    {String? this.jsonData, String? defaultJsonId}) {
  try {
    document = Document.html(html);
  } catch (e) {
    _log.warning("html data is Invalid, using <html></html> instead, $e");
    document = Document.html("<html></html>");
  }

  document = Document.html(html);
  jsonData = jsonData != null
      ? jsonDecode(jsonData)
      : (defaultJsonId != null)
          ? getJsonDataById(defaultJsonId)
          : null;
  //debugPrint("page data ${document?.documentElement}");
}