html_unescape 0.1.5

  • Example
  • Installing
  • Versions
  • 95


Build Status

A Dart library for unescaping HTML-encoded strings.


  • Named Character References ( )
    • 2099 of them
  • Decimal Character References (á)
  • Hexadecimal Character References (ã)

The idea is that while you seldom need encoding to such a level (most of the time, all you need to escape is <, >, /, & and "), you do want to make sure that you cover the whole spectrum when decoding from HTML-escaped strings.

Inspired by Java's unbescape library.


A simple usage example:

import 'package:html_unescape/html_unescape.dart';

main() {
  var unescape = new HtmlUnescape();
  var text = unescape.convert("&lt;strong&#62;This &quot;escaped&quot; string");

You can also use the converter to transform a stream. For example, the code below will transform a POSIX stdin into an HTML-unencoded stdout.

await stdin
    .transform(new Utf8Decoder())
    .transform(new HtmlUnescape())
    .transform(new Utf8Encoder())

Full versus small

If you're sure you will only encounter the most common escaped characters, you can import 'package:html_unescape/html_unescape_basic.dart' instead of the full version. This will decrease code size and increase performance. The only difference is in the size of the Named Character Reference dictionary. The full set includes the likes of &DownLeftRightVector; or &UpArrowBar; while the small set only includes the first 255 charcodes.


Please use GitHub tracker. Don't hesitate to create pull requests, too.



  • Remove deprecated dependency on ChunkedConverter (author: @andresaraujo)
  • Loosen dev dependency on path


(No records. Please see commit history.)


// Copyright (c) 2016, Filip Hracek. All rights reserved. Use of this source
// code is governed by a BSD-style license that can be found in the LICENSE
// file.

import 'package:html_unescape/html_unescape.dart';

void main() {
  var unescape = new HtmlUnescape();
  print(unescape.convert("&lt;strong&#62;This &quot;escaped&quot; string "
      "will be printed normally.</strong>"));

1. Depend on it

Add this to your package's pubspec.yaml file:

  html_unescape: "^0.1.5"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:html_unescape/html_unescape.dart';
Version Uploaded Documentation Archive
0.1.5 May 30, 2017 Go to the documentation of html_unescape 0.1.5 Download html_unescape 0.1.5 archive
0.1.4 May 25, 2016 Go to the documentation of html_unescape 0.1.4 Download html_unescape 0.1.4 archive
0.1.3 May 25, 2016 Go to the documentation of html_unescape 0.1.3 Download html_unescape 0.1.3 archive
0.1.2 May 25, 2016 Go to the documentation of html_unescape 0.1.2 Download html_unescape 0.1.2 archive
0.1.1 May 25, 2016 Go to the documentation of html_unescape 0.1.1 Download html_unescape 0.1.1 archive
0.1.0 May 25, 2016 Go to the documentation of html_unescape 0.1.0 Download html_unescape 0.1.0 archive
0.0.1 May 25, 2016 Go to the documentation of html_unescape 0.0.1 Download html_unescape 0.0.1 archive


We analyzed this package on Apr 9, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.46.0
  • pana: 0.10.6


Describes how popular the package is relative to other packages. [more]
91 / 100
Code health derived from static analysis. [more]
100 / 100
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:html_unescape/html_unescape.dart.


  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 3 hints.

    Run dartfmt to format lib/html_unescape.dart.

    Run dartfmt to format lib/html_unescape_small.dart.

    Similar analysis of the following files failed:

    • lib/src/base.dart (hint)


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.23.0 <2.0.0
Dev dependencies
path >=1.3.9 <1.5.0
test >=0.12.0 <0.13.0