addDirectory method
Implementation
@override
Future<void> addDirectory(
Directory dir, {
bool includeDirName = true,
int? level,
bool followLinks = true,
void Function(double)? onProgress,
}) async {
final List files = dir.listSync(recursive: true, followLinks: followLinks);
final futures = <Future<void>>[];
final amount = files.length;
int current = 0;
for (final file in files) {
if (file is! File) {
continue;
}
final f = file;
final dirName = path.basename(dir.path);
final relativePath = path.relative(f.path, from: dir.path);
futures.add(
addFile(
f,
includeDirName ? ('$dirName/$relativePath') : relativePath,
level,
).then((_) => onProgress?.call(++current / amount)),
);
}
await Future.wait(futures);
}