ofFolder static method
Every file under dir, by path relative to it, with its hash. Tool
folders (.dart_tool, build, .git…) are skipped.
Implementation
static Map<String, String> ofFolder(Directory dir) {
final out = <String, String>{};
if (!dir.existsSync()) return out;
final base = normalPath(dir.absolute.path);
for (final entity in dir.listSync(recursive: true, followLinks: false)) {
if (entity is! File) continue;
final rel = normalPath(entity.absolute.path).substring(base.length + 1);
if (isToolPath(rel)) continue;
out[rel] = of(rel, entity.readAsBytesSync());
}
return Map.fromEntries(
out.entries.toList()..sort((a, b) => a.key.compareTo(b.key)),
);
}