in lib/src/formatter.dart [129:169]
Future<String> prettyPrint(
Resolver resolver,
Loader loader, {
List<String>? reportOn,
bool reportFuncs = false,
}) async {
final pathFilter = _getPathFilter(reportOn);
final buf = StringBuffer();
for (final entry in entries) {
final v = entry.value;
if (reportFuncs && v.funcHits == null) {
throw 'Function coverage formatting was requested, but the hit map is '
'missing function coverage information. Did you run '
'collect_coverage with the --function-coverage flag?';
}
final hits = reportFuncs ? v.funcHits! : v.lineHits;
final source = resolver.resolve(entry.key);
if (source == null) {
continue;
}
if (!pathFilter(source)) {
continue;
}
final lines = await loader.load(source);
if (lines == null) {
continue;
}
buf.writeln(source);
for (var line = 1; line <= lines.length; line++) {
var prefix = _prefix;
if (hits.containsKey(line)) {
prefix = hits[line].toString().padLeft(_prefix.length);
}
buf.writeln('$prefix|${lines[line - 1]}');
}
}
return buf.toString();
}