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() {
var cols = 20;
var f = NumberFormat("###");
StringBuffer sb = StringBuffer();
for (var i = 0; i < _data.length; i++) {
sb.write("$i) ");
for (var j = 0; j < cols; j++) {
var data = _data[i++];
if (data == null) {
sb.write("***");
} else {
sb.write(f.format(data));
}
sb.write(" ");
if (i == _data.length) {
break;
}
}
i--;
sb.write("\n");
}
return sb.toString();
}