file_copy 1.0.7 file_copy: ^1.0.7 copied to clipboard
Package for copy files, directories, links. You can watch the copying process.
Example of copying file:
final file = File.fromUri(Uri.file('path_to_file'));
await FileCopy.copyFile(file, 'path_to_copied_file');
Example of copying directory:
final directory = Directory.fromUri(Uri.directory('path_to_directory'));
await FileCopy.copyDirectory(directory, 'path_to_copied_directory');
Example of monitoring the progress of copying using callback:
final file = File.fromUri(Uri.file('path_to_file'));
await FileCopy.copyFile(
file,
'path_to_copied_file',
onChangeProgress: (progress) {
print(progress.progress);
},
);
Example of monitoring the progress of copying using stream:
final directory = Directory.fromUri(Uri.directory('path_to_directory'));
final observable = FileCopy.watchCopyDirectory(
directory,
'path_to_copied_directory',
);
observable.progressStream.listen((event) {
print(event.progress);
});