message method Null safety

  1. @override
String message(
  1. String message,
  2. {dynamic color}

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 ANSI terminal color escape that should be used to highlight the span's text (for example, "\u001b[31m" will color red). 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.

This uses the full range of Unicode characters to highlight the source span if glyph.ascii is false (the default), but only uses ASCII characters if it's true.


String message(String message, {color}) {
  final buffer = StringBuffer()
    ..write('line ${start.line + 1}, column ${start.column + 1}');
  if (sourceUrl != null) buffer.write(' of ${p.prettyUri(sourceUrl)}');
  buffer.write(': $message');

  final highlight = this.highlight(color: color);
  if (highlight.isNotEmpty) {

  return buffer.toString();