extractArchiveToDisk function Null safety

void extractArchiveToDisk(
  1. Archive archive,
  2. String outputPath
)

Implementation

void extractArchiveToDisk(Archive archive, String outputPath) {
  final outDir = Directory(outputPath);
  if (!outDir.existsSync()) {
    outDir.createSync(recursive: true);
  }
  for (final file in archive.files) {
    if (!file.isFile) {
      continue;
    }
    final f = File('${outputPath}${Platform.pathSeparator}${file.name}');
    f.parent.createSync(recursive: true);
    f.writeAsBytesSync(file.content as List<int>);
  }
}