percent static method

String percent(
  1. num value, {
  2. int decimalPlaces = 0,
})

e.g. 0.75 → "75%"

Implementation

static String percent(num value, {int decimalPlaces = 0}) {
  final formatter =
      NumberFormat.percentPattern()
        ..minimumFractionDigits = decimalPlaces
        ..maximumFractionDigits = decimalPlaces;
  return formatter.format(value);
}