toString method
override
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 primary 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.
If color
is true
or a string, secondaryColor
is used to highlight
secondarySpans.
Implementation
@override
String toString({Object? color, String? secondaryColor}) {
if (span == null) return message;
var useColor = false;
String? primaryColor;
if (color is String) {
useColor = true;
primaryColor = color;
} else if (color == true) {
useColor = true;
}
final formatted = span!.messageMultiple(
message, primaryLabel, secondarySpans,
color: useColor,
primaryColor: primaryColor,
secondaryColor: secondaryColor);
return 'Error on $formatted';
}