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() {
final label = action == null
? '${store.runtimeType}'
: '${store.runtimeType}.$action';
final buffer = StringBuffer('[Orbit] $label');
if (before != null && after != null) {
final changed = diff;
buffer.write(changed.isEmpty
? ' (no field changes)'
: ' \u2014 ${changed.entries.map((e) => '${e.key}: ${e.value.$1} \u2192 ${e.value.$2}').join(', ')}');
}
buffer.write(
' \u2014 notified $listenerCount listener${listenerCount == 1 ? '' : 's'}');
if (error != null) {
buffer.write(' \u2014 threw $error');
}
return buffer.toString();
}