existsDirectory static method
This method asynchronously retrieves the directory path by calling getDirectoryPath, checks whether the directory exists using the exists method of the Directory object, and returns a Future
Implementation
static Future<bool> existsDirectory(String dirName) async {
try {
return Directory(await getDirectoryPath(dirName)).exists();
} catch (e) {
return false;
}
}