Sample code for 30+ languages & platforms
Dart Requires Chilkat v11.1.0+

HTML Entity Encode and Decode in StringBuilder

Demonstrates HTML encoding and decoding the contents of a StringBuilder.

Chilkat Dart Downloads

Dart
import 'package:chilkat/chilkat.dart';

void main() {
  final sb = CkStringBuilder();

  final s = '< é ü ç Ω Hello & World ✓ >';
  sb.append(s);

  sb.encode('html', 'utf-8');
  print(sb.getAsString());

  // Output:
  // < &eacute; &uuml; &ccedil; &ohm; Hello & World &check; >

  // To decode:
  sb.decode('html', 'utf-8');
  print(sb.getAsString());

  // Output:
  // < é ü ç Ω Hello & World ✓ >
}