emptyDirectory static method
Implementation
static Future emptyDirectory(String directory, {bool recursive = false}) {
Directory folder = Directory(directory);
return folder.exists().then((exists) => (exists)
? folder.list(recursive: recursive).listen((file) => file.delete())
: null);
}