cleanOldBins function
Implementation
void cleanOldBins(Directory binDir, Iterable yamlKeys) {
final existingBins = binDir.existsSync() ? binDir.listSync().whereType<File>().toList() : [];
final yamlSet = yamlKeys.toSet();
for (final file in existingBins) {
final name = file.uri.pathSegments.last.replaceAll('.dart', '');
if (!yamlSet.contains(name)) {
file.deleteSync();
}
}
}