hasDocumentation static method

bool hasDocumentation(
  1. Comment? comment
)

Returns true if the comment contains valid /// documentation.

This method checks for triple-slash documentation comments and ensures they contain actual content (not just empty /// lines).

Example of valid documentation:

/// This is valid documentation.

Example of invalid documentation:

///

Implementation

static bool hasDocumentation(Comment? comment) {
  if (comment == null) return false;

  for (final token in comment.tokens) {
    if (token.lexeme.startsWith('///')) {
      final content = token.lexeme.substring(3).trim();
      if (content.isNotEmpty) {
        return true;
      }
    }
  }

  return false;
}