createDir function

Future<Directory?> createDir(
  1. Directory? parent,
  2. String dirName
)

Implementation

Future<Directory?> createDir(Directory? parent, String dirName) async {
  if (parent == null || isEmpty(dirName)) return null;

  var childDir =
      Directory(parent.absolute.path + Platform.pathSeparator + dirName);
  if (!await childDir.exists()) await childDir.create();

  return childDir;
}