# toString method

1. @override

String toString()
override

Returns a string representation of this BigDecimal.

## Implementation

    @override
    String toString() {
      if (_scale == 0) {
        return _unscaledValue.toString();
      }

      String unscaledStr = _unscaledValue.abs().toString();
      bool isNegative = _unscaledValue.isNegative;

      if (unscaledStr.length <= _scale) {
        // Add leading zeros
        String zeros = '0' * (_scale - unscaledStr.length + 1);
        unscaledStr = zeros + unscaledStr;
      }

      int insertPos = unscaledStr.length - _scale;
      String result = '${unscaledStr.substring(0, insertPos)}.${unscaledStr.substring(insertPos)}';

      return isNegative ? '-$result' : result;
    }