copyTo method

  1. @override
File copyTo(
  1. Folder parentFolder
)
override

Copy this resource to a child of the parentFolder with the same kind and shortName as this resource. If this resource is a folder, then all of the contents of the folder will be recursively copied.

The parent folder is created if it does not already exist.

Existing files and folders will be overwritten.

Return the resource corresponding to this resource in the parent folder.

Implementation

@override
File copyTo(Folder parentFolder) {
  final newPath = p.join(parentFolder.path, p.basename(path));
  final newFile = fileSystem.file(newPath);

  file.copySync(newPath);

  return AnalyzerFile(newFile, provider);
}