Add more docs to dartdoc, like go_router does

What am I Missing?

I’m trying to get additional topics to appear on my documentation page using the package go_router. I’ve read the documentation and looked at the file dartdoc_options.yaml, but the topics still don’t appear.

Running dart doc . locally produces the expected directory, doc/api, but the file categories.json has an empty list, []. This means to me DartDoc is not even recognizing the categories I’ve defined.

The documentation states ‘If there is no matching category defined in dartdoc_options.yaml, those declared categories in the source code will be invisible.’ However, go_router doesn’t implement such tagging and it still works.

What am I missing?

Similar StackOverflow questions:

It seems that the issue is with DartDoc not recognizing the categories you’ve defined in your code. According to the documentation, if there is no matching category defined in dartdoc_options.yaml, the declared categories in the source code will be invisible.

To solve this issue, you need to make sure that you have defined the categories in both your code and the dartdoc_options.yaml file.

Here are the steps you can follow:

  1. Open the dartdoc_options.yaml file in your project.

  2. Check if the categories you have defined in your code are also defined in the categories section of the dartdoc_options.yaml file. Make sure the names match exactly.

  3. If the categories are not defined in the dartdoc_options.yaml file, add them under the categories section. For example:

    categories:
      - name: CategoryName
        label: Category Label
    

    Replace CategoryName with the name of your category and Category Label with the label you want to display for that category.

  4. Save the dartdoc_options.yaml file.

  5. Run dart doc . again to regenerate the documentation.

After following these steps, DartDoc should recognize the categories you’ve defined in your code, and they should appear in the generated documentation.