render method
The report as text: a line per check, what it found under it when there is more to say, and the fix.
Implementation
String render() {
final out = StringBuffer();
final what = switch (kind) {
'flutter' => 'a Flutter app${platforms.isEmpty ? '' : ' (${platforms.join(', ')})'}',
'workspace' => 'a workspace root',
_ => 'a pure-Dart package',
};
out.writeln('local_inference doctor $version: $host, $what');
out.writeln();
final idWidth = results.fold(0, (w, r) => r.id.length > w ? r.id.length : w);
for (final r in results) {
final lines = r.found.split('\n');
out.writeln('${r.status.name.padRight(8)} ${r.id.padRight(idWidth)} ${lines.first}');
final indent = ' ' * (8 + 1 + idWidth + 2);
for (final line in lines.skip(1)) {
out.writeln('$indent$line');
}
final fix = r.fix;
if (fix != null) {
final fixLines = fix.split('\n');
out.writeln('${indent}fix: ${fixLines.first}');
for (final line in fixLines.skip(1)) {
out.writeln('$indent $line');
}
}
}
out.writeln();
final summary = [
'${count(CheckStatus.ok)} ok',
'${count(CheckStatus.warning)} warning${count(CheckStatus.warning) == 1 ? '' : 's'}',
'${count(CheckStatus.error)} error${count(CheckStatus.error) == 1 ? '' : 's'}',
'${count(CheckStatus.skipped)} skipped',
];
out.write('${results.length} checks: ${summary.join(', ')}.');
if (strict) out.write(' --strict: warnings fail.');
if (!verifyNatives) out.write(' --verify-natives also hashes the native libraries.');
out.writeln(' Exit status $exitCode.');
return out.toString();
}