toString method

  1. @override
String toString()
override

Returns the Fixed value using scale to control the displayed number of decimal places.

Fixed.fromInt(1000, scale: 3).toString() == '1.000'

If you need to invert the separators or control the returned scale use format.

Implementation

@override
String toString() {
  final String pattern;
  if (scale == 0) {
    pattern = '#';
  } else {
    pattern = '0.${'#' * scale}';
  }
  final encoder = FixedEncoder(pattern);

  return encoder.encode(this);
}