I'm just poking around with dart_codemod and I was wondering if someone would be willing to suggest/discuss a strategy for finding unused classes.
My idea was to visit every class declaration and get the name of the class, then search the rest of the AST for any use of the constructor. I tried to walk the tree and wasn't successful.
void main(List<String> arguments) {
runInteractiveCodemod(
filePathsFromGlob(Glob('**.dart', recursive: true)),
PrintEveryCommentInProject(),
args: arguments,
);
}
class PrintEveryCommentInProject extends GeneralizingAstVisitor
with AstVisitingSuggestorMixin {
@override
dynamic visitDeclaration(Declaration node) {
print(node.documentationComment);
node.visitChildren(this);
}
}
I'm just poking around with
dart_codemodand I was wondering if someone would be willing to suggest/discuss a strategy for finding unused classes.My idea was to visit every class declaration and get the name of the class, then search the rest of the AST for any use of the constructor. I tried to walk the tree and wasn't successful.