Skip to content
pubscout

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.

$ flutter pub add flutter_widget_from_html
Source repository

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.

Works with

Packages commonly used together with flutter_widget_from_html: ones it builds on, ones built on it, and its own family.