percent static method

String percent(
  1. double value,
  2. int decimals, {
  3. String? locale,
})

Percentage formatter

Implementation

static String percent(double value, int decimals, {String? locale}) {
  final key = 'pct_${decimals}_${locale ?? 'en'}';
  final fmt = _numCache.putIfAbsent(
    key,
    () => NumberFormat.percentPattern(locale),
  );
  final raw = fmt.format(value / 100);
  return raw.replaceAll('%', ' %').trim(); // ECharts style spacing
}