renameAsync static method

Future<void> renameAsync(
  1. String oldPath,
  2. String newPath
)

Renames the file from oldPath to newPath. Allow path type of FileDirectoryLink.

Implementation

static Future<void> renameAsync(String oldPath, String newPath) async {
  if (await isFileAsync(oldPath)) {
    await File(oldPath).rename(newPath);
  } else if (await isDirectoryAsync(oldPath)) {
    await Directory(oldPath).rename(newPath);
  } else if (await isLinKAsync(oldPath)) {
    await Link(oldPath).rename(newPath);
  }
}