In every programming language comments play an important role for a better understanding of the code in the future or by any other programmer. Comments are a set of statements that are not meant to be executed by the compiler. They provide proper documentation of the code.
Types of Dart Comments:
- Dart Single line Comment.
- Dart Multiline Comment.
- Dart Documentation Comment.
1. Dart Single line Comment: Dart single line comment is used to comment a line until line break occurs. It is done using a double forward-slash (//).
// This is a single line comment.
2. Dart Multi-Line Comment: Dart Multiline comment is used to comment out a whole section of code. It uses ‘/*’ and ‘*/’ to start and end a multi-line comment respectively.
/* These are multiple line of comments */
[1, 2, 3]
3. Dart Documentation Comment: Dart Documentation Comments are a special type of comment used to provide references to packages, software, or projects.Dart supports two types of documentation comments “///”(C# Style) and “/**…..*/”(JavaDoc Style). It is preferred to use “///” for doc comments as many times * is used to mark list items in a bulleted list which makes it difficult to read the comments. Doc comments are recommended for writing public APIs.
/// This is /// a documentation /// comment
- How to Combine Lists in Dart?
- Basics of Numbers in Dart
- Dart - Super and This keyword
- Dart - Standard Input Output
- Generators in Dart
- Dart - Classes And Objects
- Operators in Dart
- Dart - Loops
- Switch Case in Dart
- Dart - Loop Control Statements (Break and Continue)
- Dart Programming - Functions
- Instance and class methods in Dart
- Abstract Classes in Dart
- Labels in Dart
- Dart Programming - List
- Different Types of Functions in Dart
- Dart - Splitting of String
- Method Overriding in Dart
- Concept of Isolates in Dart
- Concept of Callable Classes in Dart
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.