copyFileSync function
Copy the file at path
into target
.
Returns null if path
does not lead to a File,
else the newly created File gets returned.
Implementation
File? copyFileSync(String path, Directory target) {
if (!FileSystemEntity.isFileSync(path)) return null;
final source = File(path).absolute;
final actualTargetFilepath = target.file(source.name).absolute.path;
return source.copySync(actualTargetFilepath);
}