createDirIfNotExist function

Directory createDirIfNotExist(
  1. String dirPath
)

Creates Directory in the given dirPath if not exists

Implementation

Directory createDirIfNotExist(String dirPath) {
  final dir = Directory(path.joinAll(path.split(dirPath)));
  if (!dir.existsSync()) {
    dir.createSync(recursive: true);
  }
  return dir;
}