Flutter: Comments
What are the comments? These code snippets will be ignored by the application and will not execute. They help us to leave notes to guide ourselves or other developers through the code.
In this article, we will see three types of comments:
- One-line comments start with
\\
- Multiple line comments start with
\*
and end with*\
- Documentation comments start with
\\\
In the next code snippet, we can see the usage of each one. When we run the code, we can see the comments do not have any effect on the printed result:
In the next image, we can see the TODO
tag usage. We can see the comment in the information section. Some IDE like Android Studio and Visual Studio has support for the TODO
tag:
TODO comment
Documentation comments will be shown in the documentation section of our IDE. Check the next image:
Documentation comment
Conclusion
This was a small tutorial. We learned how comments work in Dart & Flutter and saw examples of different types of comments.