fixed method

String fixed(
  1. int fractionDigits
)

Implementation

String fixed(int fractionDigits) {
  String result;
  if (this > Decimal.fromInt(-1) && this < Decimal.one) {
    result = toStringAsPrecisionNoRound(fractionDigits);
  } else {
    result = toStringAsFixedNoRound(fractionDigits);
  }
  if (result.indexOf('.') > 0) {
    return result
        .replaceAll(RegExp(r'0+?$'), '')
        .replaceAll(RegExp(r'[.]$'), '');
  }
  return result;
}