unreferenced method
Library files that nothing in the project refers to: in-degree zero over
edges, with roots exempt.
One layer deep on purpose — a file kept alive only by another dead file is not listed. unreachable is the deeper question.
Implementation
List<String> unreferenced({required Set<String> roots}) {
final referenced = <String>{};
for (final targets in edges.values) {
referenced.addAll(targets);
}
return edges.keys
.where((file) =>
isLibraryFile(file) &&
!referenced.contains(file) &&
!roots.contains(file))
.toList()
..sort();
}