createIssue method
Helper to create a LintIssue from an AstNode with consistent formatting.
Optionally provide a customMessage to override the default problem message.
Implementation
LintIssue createIssue(AstNode node, {String? customMessage}) {
final root = node.root;
final lineInfo = root is CompilationUnit ? root.lineInfo : null;
final location = lineInfo?.getLocation(node.offset);
return LintIssue(
offset: node.offset,
length: node.length,
line: location?.lineNumber ?? 0,
column: location?.columnNumber ?? 0,
ruleName: ruleName,
message: customMessage ?? problemMessage,
correctionMessage: correctionMessage,
severity: severity,
);
}