ZipDirectory.read constructor Null safety

ZipDirectory.read(
  1. InputStreamBase input,
  2. {String? password}
)

Implementation

ZipDirectory.read(InputStreamBase input, {String? password}) {
  filePosition = _findSignature(input);
  input.position = filePosition;
  final signature = input.readUint32(); // ignore: unused_local_variable
  numberOfThisDisk = input.readUint16();
  diskWithTheStartOfTheCentralDirectory = input.readUint16();
  totalCentralDirectoryEntriesOnThisDisk = input.readUint16();
  totalCentralDirectoryEntries = input.readUint16();
  centralDirectorySize = input.readUint32();
  centralDirectoryOffset = input.readUint32();

  final len = input.readUint16();
  if (len > 0) {
    zipFileComment = input.readString(size: len, utf8: false);
  }

  _readZip64Data(input);

  final dirContent =
      input.subset(centralDirectoryOffset, centralDirectorySize);

  while (!dirContent.isEOS) {
    final fileSig = dirContent.readUint32();
    if (fileSig != ZipFileHeader.SIGNATURE) {
      break;
    }
    fileHeaders.add(ZipFileHeader(dirContent, input, password));
  }
}