deleteDir function
Implementation
void deleteDir(String path, {bool recursive = true}) {
if (!exists(path)) {
StatusHelper.failed('The path ${truepath(path)} does not exists.');
}
if (!isDirectory(path)) {
StatusHelper.failed('The path ${truepath(path)} is not a directory.');
}
try {
Directory(path).deleteSync(recursive: recursive);
} catch (e) {
StatusHelper.failed(
'Unable to delete the directory ${truepath(path)}. Error: $e');
}
}