autoUnitFormat property

String get autoUnitFormat

Implementation

String get autoUnitFormat {
  if (this == null) return '0';

  final value = this!.toDouble();
  if (value >= 1e8) {
    return '${(value / 1e8).toStringAsFixed(2)}亿';
  } else if (value >= 1e4) {
    return '${(value / 1e4).toStringAsFixed(2)}万';
  } else {
    return value.toInt().toString();
  }
}