copyDirectoryImpl function

Future<int> copyDirectoryImpl(
  1. Directory src,
  2. Directory? dst, {
  3. CopyOptions? options,
})

Implementation

Future<int> copyDirectoryImpl(Directory src, Directory? dst,
    {CopyOptions? options}) async {
  options ??= defaultCopyOptions;
  if (await src.fs.isDirectory(src.path)) {
    // delete destination first?
    if (options.delete) {
      await deleteDirectory(dst!);
    }
    return await TopCopy(
            TopEntity(src.fs, src.path), TopEntity(dst!.fs, dst.path),
            options: options)
        .run();
  } else {
    throw ArgumentError('not a directory ($src)');
  }
}