rename static method
Implementation
static Future<File> rename(
String filePath,
String newName, {
bool keepExtension = true,
}) async {
File sourceFile = File(filePath);
String fileExtension = path_operations.extension(filePath);
String parentPath = sourceFile.parent.path.strip('/');
String newPath;
if (keepExtension) {
newPath = '$parentPath/$newName$fileExtension';
} else {
newPath = '$parentPath/$newName';
}
return sourceFile.rename(newPath);
}