createDirSync static method

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

异步创建文件夹

Implementation

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