message method
override
Formats message
in a human-friendly way associated with this span.
color
may either be a String, a bool, or null
. If it's a string,
it indicates an ANSII terminal color escape that should be used to
highlight the span's text. If it's true
, it indicates that the text
should be highlighted using the default color. If it's false
or null
,
it indicates that the text shouldn't be highlighted.
Implementation
String message(String message, {color}) {
var buffer = new StringBuffer();
buffer.write('line ${start.line + 1}, column ${start.column + 1}');
if (sourceUrl != null) buffer.write(' of ${p.prettyUri(sourceUrl)}');
buffer.write(': $message');
var highlight = this.highlight(color: color);
if (!highlight.isEmpty) {
buffer.writeln();
buffer.write(highlight);
}
return buffer.toString();
}