没有活动包 dartdoc Flutter

Tom*_*652 4 dart flutter

我正在尝试生成我的 flutter 应用程序的文档,但该dartdoc命令未按预期工作。

我努力了 :

flutter pub global deactivate dartdoc 
flutter pub global activate dartdoc 
Run Code Online (Sandbox Code Playgroud)

输出是:

Resolving dependencies...
+ _fe_analyzer_shared 31.0.0
+ analyzer 2.8.0
+ args 2.3.0
+ async 2.8.2
+ charcode 1.3.1
+ cli_util 0.3.5
+ collection 1.15.0
+ convert 3.0.1
+ crypto 3.0.1
+ csslib 0.17.1
+ dartdoc 4.1.0
+ file 6.1.2
+ glob 2.0.2
+ html 0.15.0
+ logging 1.0.2
+ markdown 4.0.1
+ meta 1.7.0
+ package_config 2.0.2
+ path 1.8.0
+ pub_semver 2.1.0
+ source_span 1.8.1
+ string_scanner 1.1.0
+ term_glyph 1.2.0
+ typed_data 1.3.0
+ watcher 1.0.1
+ yaml 3.1.0
Installed executable dartdoc.
Warning: Executable "dartdoc" runs "bin/dartdoc.dart", which was not found in dartdoc.
Warning: Pub installs executables into $HOME/Desktop/flutter/.pub-cache/bin, which is not on your path.
You can fix that by adding this to your shell's config file (.bashrc, .bash_profile, etc.):

  export PATH="$PATH":"$HOME/Desktop/flutter/.pub-cache/bin"

Activated dartdoc 4.1.0.
Run Code Online (Sandbox Code Playgroud)

我还添加了PATH导出建议。

现在,当我在 flutter 应用程序根目录中运行dartdoc命令时,输出如下:

No active package dartdoc.
Run Code Online (Sandbox Code Playgroud)

我也尝试过这样做,flutter pub cache repair但没有帮助。

我还能做些什么来让它发挥作用吗?

注意:在我升级到之前它可以工作flutter 2.8

小智 13

我也遇到过这个问题。就我而言,我设法通过运行来解决它:

dart pub global activate dartdoc
Run Code Online (Sandbox Code Playgroud)

代替:

flutter pub global activate dartdoc
Run Code Online (Sandbox Code Playgroud)