Zaka
Zaka

Reputation: 71

Flutter Dartdoc: How to Document State Objects in Statefull Widgets?

This is a part of a project where i am building a clone of the Flickr App for educational purposes.

I am playing around for the first time with Dartdoc and Documentation concept in general, I managed to use Dartdoc and create a Doc folder with documentation for my project. However, for all my Stateful widgets, The widget itself has documented Properly however the state object (the object where I have my build methods, my initstate methods, and my state variables), I don't get any documentation for that, is that the default behavior or am I doing something wrong? I want to generate Documentation for this state object, the methods inside it, and the variables inside.

Apart From that, I am getting a couple of warnings, I will search further into those, and if can't manage to resolve them I will open a separate question.

Here is how I used Dartdoc:

Dartdoc command

Dartdoc command

End of Dartdoc command

End of Dartdoc command

Generated Doc

Generated Doc

Generated Doc _ Methods

Generated Doc _ Methods

Forgive me if my question is stupid, it is my first time ever working with documentation :D

EDIT: A naive solution that I am doing, is that I moved most of my variables and methods to the widget object instead of my state object. Is this the right way to go about this?

Upvotes: 2

Views: 573

Answers (1)

jamesdlin
jamesdlin

Reputation: 90155

Your State class is private (_FlickrCameraScreen), so it will not generate public documentation. If you want public documentation for it, you will need to rename it to FlickrCameraScreenState. You can give it a private constructor if you need to restrict creation to your FlickrCameraScreen widget.

Upvotes: 1

Related Questions