dartdoc失败:顶级程序包需要Flutter,但未设置FLUTTER_ROOT环境变量

bwleehnv  于 2023-03-15  发布在  Flutter
关注(0)|答案(2)|浏览(125)

我在试着运行dartdoc来完成我的飞行计划但是我收到了这个,

dartdoc failed: Top level package requires Flutter but FLUTTER_ROOT environment variable not set.

如何添加FLUTTER_ROOT环境变量,因为我已经为Flutter SDK添加了环境变量,运行正常,我只是在运行dartdoc时遇到问题。我是Linux用户。

wr98u20j

wr98u20j1#

尝试运行flutter pub global run dartdoc:dartdoc

pinkon5k

pinkon5k2#

如果希望在开发计算机上本地生成API文档,请使用以下命令:
1.将目录更改为软件包所在的位置:

cd ~/dev/mypackage

1.告诉文档工具Flutter SDK的位置(更改以下命令以反映您放置它的位置):

export FLUTTER_ROOT=~/dev/flutter  # on macOS or Linux  
set FLUTTER_ROOT=~/dev/flutter     # on Windows

1.运行dartdoc工具(包含在Flutter SDK中),如下所示:

$FLUTTER_ROOT/bin/cache/dart-sdk/bin/resources/dartdoc   # on macOS or Linux  
%FLUTTER_ROOT%\bin\cache\dart-sdk\bin\resources\dartdoc   # on Windows

链接https://flutter.dev/docs/development/packages-and-plugins/developing-packages

相关问题