LintCode constructor

const LintCode(
  1. String name,
  2. String problemMessage, {
  3. String? correctionMessage,
  4. @Deprecated('To be removed without replacement') bool hasPublishedDocs = false,
  5. String? uniqueName,
  6. DiagnosticSeverity severity = DiagnosticSeverity.INFO,
})

Initializes a lint code.

The name is a "snake_case" name for the reported diagnostic.

The problemMessage is a concise, human-readable message indicating the problematic behavior.

The correctionMessage, if given, is a concise, human-readable message indicating one or two possible corrections.

The problemMessage and correctionMessage text is printed with a reported diagnostics. For example, dart analyze and flutter analyze will print the problemMessage with each diagnostic. The problemMessage and correctionMessage area each printed in an IDE's "problems" panel with each diagnostic.

The problemMessage and correctionMessage text can contain interpolation placeholders, in the form of {0}, {1}, etc. When a diagnostic for this LintCode is produced (for example with AnalysisRule.reportAtNode) with arguments, they are interpolated into the problemMessage and correctionMessage. 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

// TODO(srawlins): Add a 'url' parameter for plugin authors.
// TODO(srawlins): Document `uniqueName` and `severity`.
const LintCode(
  String name,
  String problemMessage, {
  super.correctionMessage,
  @Deprecated('To be removed without replacement') super.hasPublishedDocs,
  String? uniqueName,
  this.severity = DiagnosticSeverity.INFO,
}) : super(
       problemMessage: problemMessage,
       name: name,
       uniqueName: uniqueName ?? 'LintCode.$name',
     );