flutter_widget_from_html
0.17.4, released 2 months ago by daohoangson.com
Render HTML content as native Flutter widgets with support for common tags, CSS, and media.
What it does
Parses HTML strings into a tree of Flutter widgets. It supports 70+ HTML tags, inline CSS styling, hyperlinks, images, audio, video, and iframes.
AI-written summary of version 0.17.4, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to display blog posts, article text, or rich HTML content directly inside a Flutter app.
- You want to render custom HTML fragments that include formatting, lists, tables, and media elements.
Skip it when
- You are building a full-featured web browser application where complex JavaScript and DOM interaction are required.
- You want to keep app size minimal and do not need full HTML/CSS rendering capabilities.
Strengths
- Extensive support for common HTML tags, CSS styles, and counter-styles.
- Modular architecture allowing core usage or optional extensions for caching images, audio, video, and webviews.
- Provides callbacks for handling user interactions like link and image taps.
Weaknesses
- Some native media dependencies (like audio) require platform-specific permissions or podfile configurations.
- Complex CSS and extensive HTML parsing can introduce performance overhead on very large documents.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 8
iOS microphone permissions may be required if audio tag support via just_audio is included.
HtmlWidget(
'''
<h3>Heading</h3>
<p>
A paragraph with <strong>strong</strong> and <span style="color: red">colored</span> text.
</p>
''',
onTapUrl: (url) {
debugPrint('tapped $url');
return true;
},
)Alternatives
Packages that do the same job and could replace flutter_widget_from_html.
- flutter_html_iframe
Renders <iframe> tags in flutter_html using webview_flutter.
55Compare - flutter_html_table
Renders HTML table tags within the flutter_html package using flutter_layout_grid.
60Compare - flutter_html
Renders static HTML and CSS as Flutter widget trees.
56Compare - seo_renderer
Renders Flutter text, link, and image widgets as HTML elements for SEO purposes on the web.
50Compare
Works with
Packages commonly used together with flutter_widget_from_html: ones it builds on, ones built on it, and its own family.
- htmlflutter_widget_from_html depends on itA Dart implementation of an HTML5 parser for strings and bytes.
- flutter_widget_from_html_coreflutter_widget_from_html depends on itRender HTML content as native Flutter widgets with correctness and extensibility.
- fwfh_webviewflutter_widget_from_html depends on itWidgetFactory extension to render IFRAME elements using the official WebView plugin.
- fwfh_svgflutter_widget_from_html depends on itWidgetFactory extension to render SVG inside HTML widgets via flutter_svg.
- fwfh_url_launcherflutter_widget_from_html depends on itWidgetFactory mixin to launch links in HTML widgets via url_launcher.
- fwfh_cached_network_imageflutter_widget_from_html depends on itWidgetFactory extension to render HTML IMG tags using cached_network_image.
- fwfh_chewieflutter_widget_from_html depends on itRender VIDEO tags using Chewie inside HtmlWidget
- core_kitBuilt on flutter_widget_from_htmlSPM-ready Flutter UI kit with responsive scaling, Dio HTTP, auth, secure storage, and 35+ widgets.