flutter_html
3.0.0, released 2 years ago by sub6resources.com
Renders static HTML and CSS as Flutter widget trees.
What it does
The package parses HTML strings and CSS styles, converting them into native Flutter widgets. It supports many tags out of the box and allows custom extensions for unknown tags.
AI-written summary of version 3.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to display rich text content from HTML sources in a Flutter app
- You want to apply CSS‑like styling without writing custom widget code
- You need quick rendering of static HTML without a full webview
Skip it when
- You require interactive JavaScript execution
- You need full web page features like forms, navigation, or dynamic scripts
Strengths
- Supports over a hundred HTML tags and many CSS properties
- Customizable via extensions and style maps
- No platform‑specific webview dependencies
Weaknesses
- Does not execute JavaScript or handle dynamic web content
- Large HTML may impact performance compared to native widgets
- Limited to static rendering; complex layouts may need workarounds
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
Widget build(BuildContext context) {
return Html(
data: """
<h1>Hello, World!</h1>
<p class='fancy'>Styled paragraph</p>
""",
style: {
"p.fancy": Style(
backgroundColor: Colors.grey,
fontWeight: FontWeight.bold,
),
},
);
}Alternatives
Packages that do the same job and could replace flutter_html.
- flutter_widget_from_html_core
Render HTML content as native Flutter widgets with correctness and extensibility.
92Compare - flutter_widget_from_html
Render HTML content as native Flutter widgets with support for common tags, CSS, and media.
89Compare - vyuh_diagram_flutter
Flutter canvas for diagrams with pan, zoom, selection and theming
79Compare - simple_html_css
Convert simple HTML and inline CSS styles into RichText or TextSpan widgets.
50Compare
Works with
Packages commonly used together with flutter_html: ones it builds on, ones built on it, and its own family.
- htmlflutter_html depends on itA Dart implementation of an HTML5 parser for strings and bytes.
- csslibflutter_html depends on itA Dart library that parses CSS strings or byte lists into an AST.
- list_counterflutter_html depends on itUtility for generating list markers in many numbering styles
- flutter_html_tableBuilt on flutter_htmlRenders HTML table tags within the flutter_html package using flutter_layout_grid.
- flutter_html_iframeBuilt on flutter_htmlRenders <iframe> tags in flutter_html using webview_flutter.
- flutter_html_mathBuilt on flutter_htmlRenders <math> tags in flutter_html using flutter_math_fork.
- epub_viewBuilt on flutter_htmlFlutter widget for view EPUB documents on on Web, MacOs, Android and iOS. Based on dart-epub package.
- flutter_html_allBuilt on flutter_htmlConvenience package exporting all optional flutter_html widgets.