toString method

String toString(
  1. {Object? color}

Returns a string representation of this.

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. 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.


String toString({Object? color}) {
  var buffer = StringBuffer()
    ..writeln("Error: $message")
    ..write(span.highlight(color: color));

  for (var frame in trace.toString().split("\n")) {
    if (frame.isEmpty) continue;
    buffer.write("  $frame");
  return buffer.toString();