zipDirectory method Null safety

void zipDirectory(
  1. Directory dir,
  2. {String? filename,
  3. int? level,
  4. bool followLinks = true,
  5. DateTime? modified}
)

Implementation

void zipDirectory(Directory dir,
    {String? filename,
    int? level,
    bool followLinks = true,
    DateTime? modified}) {
  final dirPath = dir.path;
  final zipPath = filename ?? '$dirPath.zip';
  level ??= GZIP;
  create(zipPath, level: level, modified: modified);
  addDirectory(dir,
      includeDirName: false, level: level, followLinks: followLinks);
  close();
}