processFileIfChanged static method
Processes file only if it has changed.
Pass log: true (watch events, single-file generate) to emit a one-line
🔧 <output> · <ms> when a .craft.dart is actually written. The startup
batch leaves it false and prints a single summary line instead.
Implementation
static Future<void> processFileIfChanged(
File file, {
bool log = false,
}) async {
final filePath = file.path;
final lastModified = await file.lastModified();
if (_fileModificationCache[filePath] == lastModified) {
return; // File hasn't changed
}
_fileModificationCache[filePath] = lastModified;
final contents = await file.readAsString();
await processProviderFile(contents, file, log: log);
}