timer static method

TimeValue timer({
  1. required int seconds,
})

convert total second to time value seconds, minutes, hours, days

Implementation

static TimeValue timer({required int seconds}) {
  TimeValue timeValue = TimeValue();
  Duration duration = Duration(seconds: seconds);

  timeValue.inSeconds = duration.inSeconds;
  timeValue.inMinutes = duration.inMinutes;
  timeValue.inHours = duration.inHours;
  timeValue.inDays = duration.inDays;

  timeValue.seconds = duration.inSeconds % 60;
  timeValue.minutes = duration.inMinutes % 60;
  timeValue.hours = duration.inHours % 24;
  timeValue.days = duration.inDays;

  return timeValue;
}