addFix method
Adds a fix for the given diagnostic
. 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(
Diagnostic diagnostic,
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(
diagnostic,
PrioritizedSourceChange(kind.priority, change),
);
}