decodeBuffer method Null safety

List<int> decodeBuffer(
  1. InputStreamBase input,
  2. {bool verify = false}
)

Implementation

List<int> decodeBuffer(InputStreamBase input, {bool verify = false}) {
  _readHeader(input);

  // Inflate
  final buffer = Inflate.buffer(input).getBytes();

  if (verify) {
    var crc = input.readUint32();
    var computedCrc = getCrc32(buffer);
    if (crc != computedCrc) {
      throw ArchiveException('Invalid CRC checksum');
    }

    var size = input.readUint32();
    if (size != buffer.length) {
      throw ArchiveException('Size of decompressed file not correct');
    }
  }

  return buffer;
}