Skip to content
pubscout

flutter_html

3.0.0, released 2 years ago by sub6resources.com

Renders static HTML and CSS as Flutter widget trees.

Quiet but busy
$ flutter pub add flutter_html
Source repository

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.

Works with

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