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() {
StringBuffer sb = StringBuffer('\nBook:\n');
sb.writeln(' title:$title');
sb.writeln(' full_title:$full_title');
sb.writeln(' subtitle:$subtitle');
sb.write(' authors:[');
for (int i = 0; i < authors.length; i++) {
sb.write('${authors[i]}${i < authors.length - 1 ? ',' : ''}');
}
sb.writeln(']');
sb.writeln(
' number_of_pages:${number_of_pages > 0 ? number_of_pages : ''}');
sb.writeln(' subjects:$subjects');
sb.writeln(' contributions:$contributions');
sb.writeln(' isbn_10:$isbn_10');
sb.writeln(' isbn_13:$isbn_13');
sb.writeln(' ia_box_id:$ia_box_id');
sb.writeln(' ocaid:$ocaid');
sb.writeln(' publishers:$publishers');
sb.writeln(' publish_places:$publish_places');
sb.writeln(' publish_date:$publish_date');
sb.writeln(' physical_format:$physical_format');
sb.writeln(' physical_dimensions:$physical_dimensions');
sb.writeln(' weight:$weight');
sb.writeln(' revision:${revision > 0 ? revision : ""}');
sb.writeln(
' latest_revision:${latest_revision > 0 ? latest_revision : ""}');
sb.writeln(' covers:${covers.length}');
sb.writeln(' pagination:$pagination');
sb.writeln(' lc_classifications:$lc_classifications');
return sb.toString();
}