copyWithProgressIntoDirectory method

Future<void> copyWithProgressIntoDirectory(
  1. Directory target,
  2. FileSystemEntityCopyProgressCb onProgress, {
  3. Context? pathContext,
})

Copies this file into target.

Returns a Future<File> that completes with a File for the copied file.

If target already contains a file with the same name as this, then the existing file is removed first. If target contains a directory with the same name as this, then the operation fails and the future completes with an exception.

Implementation

Future<void> copyWithProgressIntoDirectory(
  Directory target,
  FileSystemEntityCopyProgressCb onProgress, {
  lib_path.Context? pathContext,
}) {
  pathContext ??= lib_path.context;
  final newFilepath = pathContext.join(
    target.path,
    getName(pathContext: pathContext),
  );
  return copyWithProgress(newFilepath, onProgress);
}