HtmlWidget class

Converts HTML content to Flutter widgets programmatically

Example:

final htmlWidget = WebViewerHelper.widget('<div><h1>Title</h1></div>');
Widget widget = htmlWidget.toWidget();
String text = htmlWidget.extractText();

Constructors

HtmlWidget(String htmlContent, {HtmlStyleConfig? config})

Properties

config HtmlStyleConfig?
Optional style configuration
final
hashCode int
The hash code for this object.
no setterinherited
htmlContent String
The raw HTML content
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

extractImages() List<String>
Extract all image sources from HTML
Extract all links (href values) from HTML
extractMetaTags() Map<String, String>
Extract meta tags from HTML
extractText() String
Extract plain text from HTML
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
querySelector(String selector) String?
Query first element matching a simple selector
querySelectorAll(String selector) List<String>
Query all elements matching a simple selector (tag name)
toString() String
A string representation of this object.
inherited
toWidget({BoxConstraints? constraints}) Widget
Convert HTML to a single Flutter widget
toWidgetList() List<Widget>
Convert HTML to a list of widgets (useful for ListView)
transform(String transformer(String html)) HtmlWidget
Transform HTML content with a custom transformer

Operators

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