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

List Files in a .zip

See more Zip Examples

How to list files within a .zip

Chilkat Dart Downloads

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

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

  final zip = CkZip();

  try {
    zip.openZip('a.zip');
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

  // Get the number of files and directories in the .zip
  final n = zip.numEntries;

  final entry = CkZipEntry();

  var i = 0;

  while (i < n) {
    zip.entryAt(i, entry);
    if (!entry.isDirectory) {
      // (the filename may include a path)
      print(entry.fileName);
    }

    i++;
  }
}