Html constructor

Html({
  1. Key? key,
  2. GlobalKey<State<StatefulWidget>>? anchorKey,
  3. required String? data,
  4. OnTap? onLinkTap,
  5. OnTap? onAnchorTap,
  6. List<HtmlExtension> extensions = const [],
  7. OnCssParseError? onCssParseError,
  8. bool shrinkWrap = false,
  9. Set<String>? onlyRenderTheseTags,
  10. Set<String>? doNotRenderTheseTags,
  11. Map<String, Style> style = const {},
})

The Html widget takes HTML as input and displays a RichText tree of the parsed HTML content.

Attributes

data required takes in a String of HTML data (required only for Html constructor).

document required takes in a Document of HTML data (required only for Html.fromDom constructor).

extensions A list of Extensions that add additional capabilities to flutter_html See the Extension class for more details.

onLinkTap This function is called whenever a link (<a href>) is tapped.

shrinkWrap This makes the Html widget take up only the width it needs and no more.

onlyRenderTheseTags provides an exclusive list of tags to render.

doNotRenderTheseTags provides a short list of tags that the Html widget should completely ignore.

style Pass in the style information for the Html here. See its wiki page for more info.

Implementation

Html({
  Key? key,
  GlobalKey? anchorKey,
  required this.data,
  this.onLinkTap,
  this.onAnchorTap,
  this.extensions = const [],
  this.onCssParseError,
  this.shrinkWrap = false,
  this.onlyRenderTheseTags,
  this.doNotRenderTheseTags,
  this.style = const {},
})  : documentElement = null,
      assert(data != null),
      _anchorKey = anchorKey ?? GlobalKey(),
      super(key: key);