snapshotTarget function
Implementation
Map<String, int> snapshotTarget(String canonicalDestination) {
final root = Directory(canonicalDestination);
if (!root.existsSync()) return {};
final rawRoot = root.path;
final rootPath = rawRoot.endsWith(Platform.pathSeparator)
? rawRoot.substring(0, rawRoot.length - 1)
: rawRoot;
final prefix = '$rootPath${Platform.pathSeparator}';
return {
for (final entity in root.listSync(recursive: true, followLinks: false))
if (entity is File)
entity.path
.substring(prefix.length)
.replaceAll(Platform.pathSeparator, '/'): int.parse(
computeRawHash(entity.readAsBytesSync()).substring(0, 15),
radix: 16,
),
};
}