toString method
A string representation of this object.
Some classes have a default textual representation,
often paired with a static parse
function (like int.parse).
These classes will provide the textual representation as
their string representation.
Other classes have no meaningful textual representation
that a program will care about.
Such classes will typically override toString
to provide
useful information when inspecting the object,
mainly for debugging or logging.
Implementation
@override
String toString() {
if (label.isNotEmpty) {
return label;
}
var name = '$runtimeType';
final index = name.indexOf('<');
if (index != -1) {
name = name.substring(0, index);
}
if (name.endsWith('Parser')) {
name = name.substring(0, name.length - 6);
}
name = name[0].toLowerCase() + name.substring(1);
return name;
}