createDir function

String createDir(
  1. String path, {
  2. required bool recursive,
})

Implementation

String createDir(String path, {required bool recursive}) {
  try {
    if (exists(path)) {
      StatusHelper.failed('The path ${truepath(path)} already exists');
    }

    Directory(path).createSync(recursive: recursive);
  } catch (e) {
    StatusHelper.failed(
        'Unable to create the directory ${truepath(path)}. Error: $e');
  }
  return path;
}