run method

  1. @override
void run(
  1. CustomLintResolver resolver,
  2. ChangeReporter reporter,
  3. CustomLintContext context,
  4. Diagnostic diagnostic,
  5. List<Diagnostic> diagnostics,
)

Emits lints for a given file.

run will only be invoked with files respecting filesToAnalyze Emits source changes for a given error.

Optionally others can be specified with a list of similar errors within the same file. This can be used to provide an option for fixing multiple errors at once.

Implementation

@override
void run(
  CustomLintResolver resolver,
  ChangeReporter reporter,
  CustomLintContext context,
  Diagnostic diagnostic,
  List<Diagnostic> diagnostics,
) {
  reporter
      .createChangeBuilder(message: 'Replace with $widgetName', priority: 1)
      .addDartFileEdit(
        (builder) =>
            builder.addSimpleReplacement(diagnostic.sourceRange, widgetName),
      );
}