calculatePercentage function

String calculatePercentage(
  1. double numerator
)

Implementation

String calculatePercentage(double numerator) {
  double denominator = 100;
  double percentage = (numerator / denominator) * 100;

  if(percentage >= 100.0) {
    return 100.0.toString();
  }

  return '${percentage.toInt()}%';
}