Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What is the difference between // and /// in flutter

I was just commenting my application as i found out that you can use diffrent commenting. I’am curious if there are some commenting rules for this or has it something to do with the auto commenting of flutter it self?

My choice go’s to the /// one since the color is different so it is better to see what i commented and what flutter did.

This make me wonder why there are two diffrent ways to comment

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

//  <-- This is a way
/// <-- This is a way

enter image description here

Thanks in advance

>Solution :

In Flutter, // is used to create a single-line comment, which is ignored by the Dart compiler.

/// is used to create a documentation comment, which can be used to generate documentation for your code using the dartdoc tool. This type of comment is also ignored by the Dart compiler, but it can be used to provide additional information about a class, function, or variable for developers reading the code.


Example:

/// This is a documentation comment for a function
void myFunction() {
  // this is a single-line comment
}

When you use dartdoc tool, it will extract the comments from the code and generates the documentation in HTML format.

In addition to this refer the official documentation about dartdoc guides-documenting-dart-libraries. For the usage and examples refer guides_dartdoc

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading