getDirPath static method

Future<String?> getDirPath(
  1. String path, {
  2. FileDir root = FileDir.temporary,
})

Implementation

static Future<String?> getDirPath(
  String path, {
  FileDir root = FileDir.temporary,
}) async {
  final rootPath = await root.path;
  if (null == rootPath) return null;
  final dir = Directory(join(rootPath, path));
  if (!dir.existsSync()) dir.createSync(recursive: true);
  return dir.path;
}