问题
Is there a way to see how packages in my flutter project depend on each other? Under packages I mean internal packages: folders under 'lib'. Also, it would be great to check for circular dependencies between the packages.
回答1:
While I did not find a tool to detect dependencies, I prefix my folders with numbers, ordering them by abstraction level: higher level at the top, and lower level at the bottom.
And, to avoid circular dependencies, I watch the packages to reference only larger numbers, not smaller:
回答2:
You can use below command to see your flutter app's dependency graph.
flutter pub deps
The dependency information is printed as a tree, a list, or a compact list.
来源:https://stackoverflow.com/questions/57174506/how-can-i-see-dependency-diagram-in-flutter