ensureFolderExists static method

Future<Directory> ensureFolderExists(
  1. String directory
)

Implementation

static Future<Directory> ensureFolderExists(String directory) {
  Directory folder = Directory(directory);
  return folder
      .exists()
      .then((exists) async => (exists) ? folder : await folder.create());
}