DCDG Dart 图:未处理的异常:错误状态:无法找到文件夹名称\env.dart 的上下文

que*_*ker 5 class-diagram dart dart-pub

我一直在尝试为我的代码生成 dart 图,但出现以下错误:

C:\Users\Foldername\AppData\Local\Pub\Cache\bin>dart pub global run dcdg
C:\Users\Foldername\AppData\Local\Pub\Cache\bin\lib

Unhandled exception:

Bad state: Unable to find the context to C:\Users\Foldername\AppData\Local\Pub\Cache\bin\lib\.env.dart
#0      AnalysisContextCollectionImpl.contextFor (package:analyzer/src/dart/analysis/analysis_context_collection.dart:106:5)
#1      findClassElements (package:dcdg/src/find_class_elements.dart:46:39)
#2      main (file:///C:/Users/Foldername/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/dcdg-4.0.1/bin/dcdg.dart:35:25)
#3      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:32)
#4      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
Run Code Online (Sandbox Code Playgroud)

1-我已激活该软件包。

2-我已经更新到最新了。

3-环境变量设置正确。

我仍然不明白为什么它不允许我为我的代码创建类图。有人有答案吗?

Pau*_*tel 0

我认为您的项目中可能存在使用代码生成(使用build_runner)的依赖项,例如freezedauto_routelocalizelyhivedcdg目前的包(版本 4.1.0)在为此类项目生成 PlantUML 文件时存在问题。如果您想使用,dcdg您需要重构代码并删除此类依赖项。

这是与您的案例相关的 github 问题。