The first problem I encountered — and which I think is related to the main one — is with respect to the FLUTTER_ROOT
variable.
I don't know why it wasn't preset at some point in the installation, but, anyway, I just can't seem to set it from within VS Code, not even if I open it with administrator permissions.
If I run dartdoc
in VS Code I get the following error:
Documenting <package_name>...
dartdoc failed: Top level package requires Flutter but FLUTTER_ROOT environment variable not set.
My configurations:
bin
folder for Flutter is located at C:\src\flutter\flutter
. FLUTTER_ROOT
environment variable has the C:\src\flutter\flutter
value for both my user and the system.If I run it with permissions in Powershell or Command Prompt, it parses every dart core library (dart-async
, dart-collection
, dart-core
, etc.) and every Flutter core library, which I think is understandable to generate my library's docs, but then it also generates docs for all of those dart core libraries. Is this the intended behavior?
I still don't know why this is happening or if it's intended, but one thing that has worked for me is:
dartdoc --include <library_name>
This will make sure only your package is included in the docs and not its dependencies. From dartdoc --help
:
--include
: Library names to generate docs for.
Just make sure to restart dhttpd
:
dhttpd --path doc/api
That all still doesn't explain the trouble I had with the FLUTTER_ROOT
environment variable (Windows) though.