Skip to main content
A multi-line comment in Dart is a lexical construct that instructs the compiler to ignore all text enclosed within a specific pair of delimiters, allowing for block-level text that spans one or more lines. The syntax begins with a forward slash followed by an asterisk (/*) and terminates with an asterisk followed by a forward slash (*/).
A distinguishing technical feature of Dart’s multi-line comments is that they fully support nesting. The Dart analyzer tracks the depth of the comment blocks, requiring an exact match between the number of opening /* and closing */ tokens to successfully terminate the outer comment. This prevents premature termination errors common in other C-family languages.
Because the parser evaluates the entire comment block as a single whitespace character, multi-line comments can also be placed inline within a single statement without breaking the syntax.
Tired of Poor Dart Skills? Fix That With Deep Grasping!Learn More