unzip function

Future<void> unzip({
  1. required File sourceFile,
  2. required Directory outputDirectory,
  3. bool overWrite = false,
})

UnZips the non-.zip file into a folder

Implementation

Future<void> unzip({
  required File sourceFile,
  required Directory outputDirectory,
  ///Overwrite the files and folders at the output directory if file/folder names exist.
  bool overWrite = false,
})async{
  String json = await sourceFile.readAsString();
  Map<String, dynamic>? map;
  try{
    map = jsonDecode(json);
  }catch(error){
    throw ZipperError.errorParsing;
  }
  //Start the function that will extract the merged files
  await _setFilesFromObject(
    extractionDirectory: outputDirectory,
    map: map!,
    overWrite: overWrite,
  );
}