toString method
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() {
if (left == 0 && top == 0 && right == 0 && bottom == 0) {
return 'Spacing.none';
}
if (left == right && top == bottom) {
if (left == top) {
return 'Spacing.all($left)';
}
if (left == 0 && top == 0) {
return 'Spacing.none';
}
if (left == 0) {
return 'Spacing.vertical($top)';
}
if (top == 0) {
return 'Spacing.horizontal($left)';
}
return 'Spacing.symmetric(vertical: $top, horizontal: $left)';
}
return 'Spacing.fromLTRB($left, $top, $right, $bottom)';
}