copyDirectoryListFiles function

Future<List<File>> copyDirectoryListFiles(
  1. Directory src, {
  2. Directory? dst,
  3. CopyOptions? options,
})

Implementation

Future<List<File>> copyDirectoryListFiles(Directory src,
    {Directory? dst, CopyOptions? options}) async {
  options ??= defaultCopyOptions;
  if (await src.fs.isDirectory(src.path)) {
    var operations =
        await TopSourceNode(TopEntity(src.fs, src.path), options: options)
            ._runTree();
    return operations
        .where((operation) => !operation.isDirectory!)
        .map((operation) => src.fs.file(operation.src!.path))
        .toList(growable: false);
  } else {
    throw ArgumentError('not a directory ($src)');
  }
}