toString method

  1. @override
String toString()
override

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() {
  String classes = "";
  if (color != null) {
    classes += "color-$color";
  } else if (left != null) {
    classes += "color-l-$color";
  } else if (right != null) {
    classes += "color-r-$color";
  } else if (top != null) {
    classes += "color-t-$color";
  } else if (bottom != null) {
    classes += "color-b-$color";
  } else if (x != null) {
    classes += "color-x-$color";
  } else if (y != null) {
    classes += "color-y-$color";
  } else if (inlineStart != null) {
    classes += "color-s-$color";
  } else if (inlineEnd != null) {
    classes += "color-e-$color";
  }
  return classes;
}