pathRename function

void pathRename(
  1. String oldPath,
  2. String newPath
)

Renames a file or a directory

Implementation

void pathRename(String oldPath, String newPath) {
  if (directoryExists(oldPath)) {
    dart_io.Directory(oldPath).renameSync(newPath);
  } else if (fileExists(oldPath)) {
    dart_io.File(oldPath).renameSync(newPath);
  } else {
    throw Exception('$oldPath does not exist');
  }
}