createDir static method

Future<Directory?> createDir(
  1. String? path
)

异步创建文件夹

Implementation

static Future<Directory?> createDir(String? path) async {
  if (path == null) return null;
  Directory dir = Directory(path);
  bool exist = await dir.exists();
  if (!exist) {
    dir = await dir.create(recursive: true);
  }
  return dir;
}