1

this question is about static analysis of dart code. How can I analyze the dart code or visit the each class within a dart file so I could remove the duplicate class, I know these tools exists but i don't know how exactly implement it PS:duplicate class exists due to code generation using quicktype.

//psuedo code
classes = readTheDartFileSomeHow();
var map = Map<string,string>()
for (final myClass in classes){
 map.putIfAbsent(myClass.name,myClass);
}
Yadu
  • 2,979
  • 2
  • 12
  • 27

1 Answers1

1

You can try develop custom plugin to Dart Analyzer and add it to your project. Start with Official Tutorial for get a short overview about how it works.

Also, community has some custom plugins and you can explore source code for find useful practises (for example: dart-code-metrics) and dart-enum-to-string-check).

fartem
  • 2,361
  • 2
  • 8
  • 20