format method

String format(
  1. dynamic number
)

Format number according to our pattern and return the formatted string.

Implementation

String format(number) {
  if (_isNaN(number)) return symbols.NAN;
  if (_isInfinite(number)) return '${_signPrefix(number)}${symbols.INFINITY}';

  _add(_signPrefix(number));
  _formatNumber(number.abs());
  _add(_signSuffix(number));

  var result = _buffer.toString();
  _buffer.clear();
  return result;
}