addFix method

void addFix(
  1. AnalysisError error,
  2. FixKind kind,
  3. ChangeBuilder builder, {
  4. List<Object>? args,
})

Add a fix for the given error. Use the kind of the fix to get the message and priority, and use the change builder to get the edits that comprise the fix. If the message has parameters, then use the list of args to populate the message.

Implementation

void addFix(AnalysisError error, FixKind kind, ChangeBuilder builder,
    {List<Object>? args}) {
  var change = builder.sourceChange;
  if (change.edits.isEmpty) {
    return;
  }
  change.id = kind.id;
  change.message = formatList(kind.message, args);
  collector?.addFix(error, PrioritizedSourceChange(kind.priority, change));
}