formatDuration function

String formatDuration(
  1. int seconds
)

Implementation

String formatDuration(int seconds) {
  int hours = seconds ~/ 3600; // 3600 seconds in an hour
  int minutes = (seconds % 3600) ~/ 60; // 60 seconds in a minute
  int remainingSeconds = seconds % 60;

  String formattedTime =
      '${hours.toString().padLeft(2, '0')}:${minutes.toString().padLeft(2, '0')}:${remainingSeconds.toString().padLeft(2, '0')}';

  return formattedTime;
}