windowsflutterdartdocumentationdartdoc

(Windows) `dartdoc` generating documentation files for every base library in the Dart's and Flutter's SDKs when running against my (tiny) package


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:

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?


Solution

  • 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.