moneyFormatWithUnit method

String moneyFormatWithUnit(
  1. bool autoMoneyUnit
)

Implementation

String moneyFormatWithUnit(bool autoMoneyUnit) {
  if (isNullOrEmpty) return "0.00";
  final money = double.tryParse(this!) ?? 0.0;

  if (autoMoneyUnit && money >= 1000000) {
    return "${(money / 1000000).toStringAsFixed(2)}万";
  }

  return (money / 100).toStringAsFixed(2);
}