formatValue<T extends num> method

String formatValue<T extends num>(
  1. T? value
)

Formats a number to a string based on the theme properties.

Implementation

String formatValue<T extends num>(T? value) {
  if (value == null || value == 0) return '';

  if (T == int) {
    return value.toInt().toString();
  }

  return decimals != null ? value.toStringAsFixed(decimals!) : value.toString();
}