html_to_flutter library

Core implementation for Html.

This package exposes Html entrypoint to parse HTML content and convert it to Flutter widgets.

It is a set of bare minimum classes and interfaces to parse HTML content that supports rudimentary HTML tags and attributes.

It is designed to be extended by other packages to provide more features.

Usage

import 'package:flutter/material.dart';
import 'package:html_to_flutter/html_to_flutter.dart';

void main() {
 runApp(
  const MaterialApp(
      home: Scaffold(
        body: Html(data: '<h1>Hello World</h1>'),
      ),
    ),
  );
}

Classes

CssColorParser
A parser that parses CSS color values.
Html
This class represents all supported CSS properties by this package.
HtmlConfig
This class represents all configurations for parsing HTML.
HtmlExtension
The HtmlExtension class is the base class for all extensions.
ParsedResult
ParsedResult represents the result of parsing HTML.
Spacing
This class represents properties like margin, padding, etc.
Style
This class represents all supported CSS properties by this package.
TagExtension
Creates an extension for the specified tag.
Value
This class represents a spacing value.

Enums

RenderMode
Defines how the children of Html should be rendered.
SpacingValueUnit
The unit of a spacing value.

Extensions

ValidElementExtension on List<Node>
Helper for Node extensions.

Functions

parseHtml(String html) Document
Parse HTML string to Document.

Typedefs

Document = Document
Alias for package:html/dom.dart dom.Document.
HTMLElement = Element
Alias for package:html/dom.dart dom.Element.
HTMLText = Text
Alias for package:html/dom.dart dom.Text.
Node = Node
Alias for package:html/dom.dart dom.Node.
NodeList = NodeList
Alias for package:html/dom.dart dom.NodeList.
OnLinkTap = void Function(String? url, [Map<Object, String>? attributes, HTMLElement? element])
Signature for tap event handler.