Sample code for 30+ languages & platforms
Dart

Ungzip Base64 String

See more Gzip Examples

Suppose you have a gzip in base64 representation that contains a text file, such as XML. This example shows how to decompress and access the string.

Chilkat Dart Downloads

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

void main() {
  // This example assumes the Chilkat API to have been previously unlocked.
  // See Global Unlock Sample for sample code.

  final gzip = CkGzip();

  final gzipBase64 = 'H4sIAAAAAAAE ... X6aZjXO3EwAA';

  final bd = CkBinData();
  bd.appendEncoded(gzipBase64, 'base64');

  try {
    gzip.uncompressBd(bd);
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

  final strXml = bd.getString('utf-8');
  print('XML:');
  print(strXml);
}