reportAtPubNode method

Diagnostic reportAtPubNode(
  1. PubspecNode node, {
  2. required DiagnosticCode diagnosticCode,
  3. List<Object> arguments = const [],
  4. List<DiagnosticMessage> contextMessages = const [],
})

Reports diagnosticCode at Pubspec node, with message arguments and contextMessages.

The arguments are interpolated into the DiagnosticCode.problemMessage and DiagnosticCode.correctionMessage text. If present, the first argument (at position 0) replaces each instance of {0}, the second argument (at position 1) replaces each instance of {1}, etc.

Implementation

Diagnostic reportAtPubNode(
  PubspecNode node, {
  required DiagnosticCode diagnosticCode,
  List<Object> arguments = const [],
  List<DiagnosticMessage> contextMessages = const [],
}) {
  // Cache diagnostic and location info for creating `AnalysisErrorInfo`s.
  var diagnostic = Diagnostic.tmp(
    source: (node as PubspecNodeImpl).source,
    offset: node.span.start.offset,
    length: node.span.length,
    diagnosticCode: diagnosticCode,
    arguments: arguments,
    contextMessages: contextMessages,
  );
  _reporter.reportError(diagnostic);
  return diagnostic;
}