Sample code for 30+ languages & platforms
Dart

StringBuilder GetEncoded

Demonstrates the Chilkat StringBuilder GetEncoded method.

Chilkat Dart Downloads

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

void main() {
  final s = 'The quick brown fox jumps over the lazy dog';

  final sb = CkStringBuilder();

  sb.append(s);

  // output: The quick brown fox jumps over the lazy dog
  print(sb.getAsString());

  // Get the string encoded to base64, without changing the contents of sb.
  // output: VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==
  print(sb.getEncoded('base64', 'utf-8'));

  // The contents of sb are not changed..
  // output: The quick brown fox jumps over the lazy dog
  print(sb.getAsString());
}