createFolderIfNotExists function

bool createFolderIfNotExists(
  1. String path
)

returns true if a folder was created and false if not

Implementation

bool createFolderIfNotExists(String path) {
  if (!Directory(path).existsSync()) {
    Directory(path).createSync(recursive: true);
    print('Folder created at $path');
    return true;
  }

  print('Folder already exists at $path');
  return false;
}