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() {
const null_ = 'null';
final left = (_left ?? _inlineStart)?.toString() ?? null_;
final top = this.top?.toString() ?? null_;
final right = (_right ?? _inlineEnd)?.toString() ?? null_;
final bottom = this.bottom?.toString() ?? null_;
if (left == right && right == top && top == bottom) {
return 'CssLengthBox.all($left)';
}
final values = [left, top, right, bottom];
if (values.where((v) => v == null_).length == 3) {
if (left != null_) {
if (_left != null) {
return 'CssLengthBox(left=$_left)';
} else {
return 'CssLengthBox(inline-start=$_inlineStart)';
}
}
if (top != null_) {
return 'CssLengthBox(top=$top)';
}
if (right != null_) {
if (_right != null) {
return 'CssLengthBox(right=$_right)';
} else {
return 'CssLengthBox(inline-end=$_inlineEnd)';
}
}
if (bottom != null_) {
return 'CssLengthBox(bottom=$bottom)';
}
}
return 'CssLengthBox($left, $top, $right, $bottom)';
}