kfenToYuanStr method

String kfenToYuanStr({
  1. String? symbol,
  2. NumFormat format = NumFormat.def,
  3. bool isPrefix = true,
})

分转元之后格式化 symbol:货币符号 ,isPrefix:货币符号是否在前面(true = $1.0 ,false = 1.0$)

  1234.kfenToYuanStr(symbol: '$',format: NumFormat.def,isPrefix: true) => $12.34

Implementation

String kfenToYuanStr(
    {String? symbol,
    NumFormat format = NumFormat.def,
    bool isPrefix = true}) {
  var feeStr = kfenToYuan().kformatStr(format: format);
  if (symbol == null || symbol.isEmpty) {
    return feeStr;
  } else {
    return isPrefix ? "$symbol$feeStr" : "$feeStr$symbol";
  }
}