deleteDir function
Delete a directory recursively or not
e.g:
- deleteFile(/storage/emulated/0/myFile.txt")
Implementation
bool deleteDir(String path, {recursive: false}) {
//print("~ deleting:" + path);
if (File(path).existsSync()) {
throw Exception("This is a file path not a directory path");
}
var file = File(path);
try {
file.delete(recursive: recursive);
return true;
} catch (error) {
throw FileManagerError(error.toString());
}
}