describeAnchorExamples function
Formats a comma-separated list of example anchors with an optional
line-number prefix, quoted for inclusion in error messages:
"160", "42", "7".
Implementation
String describeAnchorExamples([String linePrefix = '']) {
final stem = linePrefix.length > 1
? linePrefix.substring(0, linePrefix.length - 1)
: '4';
final examples = linePrefix.isNotEmpty
? [linePrefix, '${stem}2', '7']
: ['160', '42', '7'];
return examples.map((e) => '"$e"').join(', ');
}