text property

String text

Returns the formatted text representation of the Readable instance.

If fractionDigits is 0, the value is formatted with no decimal places. Otherwise, it is formatted with the specified number of decimal places, and trailing zeros are removed.

Implementation

String get text {
  if (fractionDigits == 0) return "${size.toStringAsFixed(0)} $type";
  return "${size.toStringAsFixed(fractionDigits).replaceAll(RegExp(r"([.]*0+)(?!.*\d)"), "")}${fractionDigits > 1 ? " " : ""}$type";
}