isPackageResolutionUpToDate static method
Returns true if the .dart_tool/package_config.json of
rootDirectory exists and is NOT older than its pubspec.yaml and
pubspec.lock: a stale resolution (like one restored from a cache)
may NOT reflect the current dependencies.
Implementation
static bool isPackageResolutionUpToDate(Directory rootDirectory) {
var configFile = File(
pack_path.join(rootDirectory.path, '.dart_tool', 'package_config.json'),
);
if (!configFile.existsSync()) return false;
var configTime = configFile.lastModifiedSync();
for (var name in ['pubspec.yaml', 'pubspec.lock']) {
var file = File(pack_path.join(rootDirectory.path, name));
if (file.existsSync() && file.lastModifiedSync().isAfter(configTime)) {
return false;
}
}
return true;
}