如何在Android Studio或Visual Studio Code中查找未使用的Flutter类 [英] How to find unused flutter classes in Android Studio or Visual Studio Code

查看:283
本文介绍了如何在Android Studio或Visual Studio Code中查找未使用的Flutter类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于客户端对应用程序需求的快速变化,我有近200个dart文件,其中许多未使用.除了诉诸于手动搜索之外,我有什么方法可以找到未使用的类?在Android Studio中,我可以使用检查代码"功能找到未使用的java或kotlin类.但是我找不到用于飞镖/扑打的相同目的的任何工具.

Because rapid change in app requirement from client, I have nearly 200 dart files, and many of them are unused. Is there any way for me to find unused classes except resorting to manually search one by one? In Android Studio, I can find java or kotlin classes which are unused by using "inspect code" feature. But I can't find any tools for the same purpose for dart / flutter.

谢谢您的帮助.

推荐答案

在VS代码中,文件中所有未使用的类都标记为灰色或带下划线,当您将其悬停在它们上时,会出现一个弹出窗口,告诉您该类尚未在当前文件中的任何地方使用.您可以删除所有此类.

In VS code all unused classes in a file are marked grey or underlined, and when you hover on them a popup will appear telling you that the class has not been used anywhere within your the current file. you can then delete all of such classes.

或者,对于您怀疑未使用的每个班级,您都可以进行全局搜索,方法是按vs左上角的循环图标,然后输入班级名称作为您的搜索键,从那里您可以看到是否使用

alternatively, for each class you suspect is unused, you can make a global search, by pressing on the loop icon on the top left side of vs and input the name of the class as your search key, from there you can see if it is used or not

这篇关于如何在Android Studio或Visual Studio Code中查找未使用的Flutter类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆