createDirIfNotExist function
Creates Directory in the given dirPath
if not exists
Implementation
Future<Directory> createDirIfNotExist(String dirPath) async {
final dir = Directory(path.joinAll(path.split(dirPath)));
// Using the sync method here due to `avoid_slow_async_io` lint suggestion.
if (!dir.existsSync()) {
await dir.create(recursive: true);
}
return dir;
}