Skip to content
pubscout

html_unescape

2.0.0, released 6 years ago by filiph.net

Un-escapes HTML-encoded strings supporting named, decimal, and hexadecimal character references.

WASM-ready
$ flutter pub add html_unescape
Source repository

What it does

A Dart library for unescaping HTML-encoded strings. It supports all Named Character References, Decimal Character References, and Hexadecimal Character References.

AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to decode HTML entities in text scraped from the web or fetched from APIs.
  • You want to process streams of data containing HTML-escaped characters.

Skip it when

  • You only need to escape HTML characters instead of decoding them.
  • You are looking for an HTML parser or DOM manipulation library.

Strengths

  • Supports over 2000 named character references as well as decimal and hexadecimal references.
  • Offers a small version for reduced code size and increased performance if only common characters are needed.
  • Can be used as a stream transformer.

Weaknesses

  • Limited to unescaping HTML and does not provide general HTML parsing or DOM creation features.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:html_unescape/html_unescape.dart';

main() {
  var unescape = HtmlUnescape();
  var text = unescape.convert("<strong>This "escaped" string");
  print(text);
}

Alternatives

Packages that do the same job and could replace html_unescape.

  • hex

    Provides simple HEX.encode and HEX.decode functions for converting between byte lists and hexadecimal strings.

  • b

    Dart library for converting numbers between different numeral systems and custom bases.

Works with

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