ConsoleReporter class
A Reporter that writes a human-friendly, column-aligned report to an IOSink, grouped by file.
Findings are bucketed by location.filePath while preserving the order in
which each file first appears in the input, and within each file the input
order is kept verbatim (the reporter never sorts by line, column, or
severity). Each file is emitted once as a header line, followed by one
indented row per finding laid out in aligned columns:
<severity> <line>:<column> <ruleId> <message>
Column widths are computed once across the whole report so every row lines
up. A finding's optional Diagnostic.correction is written on a
continuation line aligned under the message and prefixed with ↳. File
groups are separated by a blank line, and — unless showSummary is
false — the report ends with a one-line summary tallying findings by
severity (or a "No issues found" line when the list is empty).
Color
Styling is delegated to ansi. With the default Ansi.disabled palette
the output is plain text (identical bytes on every platform), which is the
right choice for pipes, files, and test buffers. Pass an enabled palette
to color severities, dim secondary detail, and bold headers. The reporter
never inspects the sink itself — the caller decides whether color is
appropriate (see shouldEmitAnsi).
Paths
When relativeTo is set, file headers are displayed relative to that
directory (falling back to the raw path if it lies on another root);
otherwise the path is shown verbatim. Bucketing always keys off the raw
location.filePath, so display formatting never merges distinct files.
- Implemented types
Constructors
- ConsoleReporter({required IOSink out, Ansi ansi = const Ansi.disabled(), bool showSummary = true, String? relativeTo})
-
Creates a ConsoleReporter writing to
out.const
Properties
- ansi → Ansi
-
Palette used to style the report. Defaults to plain (no color).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- out → IOSink
-
Sink that receives the grouped diagnostic report.
final
- relativeTo → String?
-
Directory that file paths are displayed relative to, or
nullto show paths verbatim.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showSummary → bool
-
When
true(the default), a summary line is appended after the findings (or emitted on its own for an empty list).final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
report(
List< Diagnostic> diagnostics) → void -
Writes
diagnosticsto the implementation's destination.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited