getDayHourPercentage static method

double getDayHourPercentage(
  1. double hoursPerDay
)

Calculates the percentage of a day that the given hours represent.

Returns a value rounded to 2 decimal places. Example: 8 hours = 33.33% of a day.

Implementation

static double getDayHourPercentage(double hoursPerDay) {
  final percentage = (hoursPerDay / 24) * 100;
  return double.parse(percentage.toStringAsFixed(2));
}