HtmlParser class

Inheritance

Constructors

HtmlParser({required Key? key, required Element htmlData, required OnTap? onLinkTap, required OnTap? onAnchorTap, required OnTap? onImageTap, required OnCssParseError? onCssParseError, required ImageErrorListener? onImageError, required bool shrinkWrap, required bool selectable, required Map<String, Style> style, required Map<CustomRenderMatcher, CustomRender> customRenders, required List<String> tagsList, Html? root, TextSelectionControls? selectionControls, ScrollPhysics? scrollPhysics})

Properties

cachedImageSizes Map<String, Size>
final
customRenders Map<CustomRenderMatcher, CustomRender>
final
hashCode int
The hash code for this object.
no setterinherited
htmlData → Element
final
internalOnAnchorTap OnTap?
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onAnchorTap OnTap?
final
onCssParseError OnCssParseError?
final
onImageError ImageErrorListener?
final
onImageTap OnTap?
final
onLinkTap OnTap?
final
root Html?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollPhysics ScrollPhysics?
final
selectable bool
final
selectionControls TextSelectionControls?
final
shrinkWrap bool
final
style Map<String, Style>
final
tagsList List<String>
final

Methods

build(BuildContext context) Widget
As the widget builds, the HTML data is processed into a tree of StyledElements, which are then parsed into an InlineSpan tree that is then rendered to the screen by Flutter
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parseTree(RenderContext context, StyledElement tree) InlineSpan
parseTree converts a tree of StyledElements to an InlineSpan tree.
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

lexDomTree(Element html, List<CustomRenderMatcher> customRenderMatchers, List<String> tagsList, BuildContext context, HtmlParser parser) StyledElement
lexDomTree converts a DOM document to a simplified tree of StyledElements.
parseCss(String data) → StyleSheet
parseCss converts a string of CSS to a CSS stylesheet using the dart csslib library.
parseHTML(String data) → Element
parseHTML converts a string of HTML to a DOM element using the dart html library.
processTree(StyledElement tree, double devicePixelRatio) StyledElement
processTree optimizes the StyledElement tree so all BlockElements are on the first level, redundant levels are collapsed, empty elements are removed, and specialty elements are processed.
styleTree(StyledElement tree, Element htmlData, Map<String, Style> style, OnCssParseError? onCssParseError) StyledElement
styleTree takes the lexed StyleElement tree and applies external, inline, and custom CSS/Flutter styles, and then cascades the styles down the tree.