timeToValue static method

TimeValue timeToValue({
  1. required String time,
})

convert time to value seconds, minutes, hours, days

Implementation

static TimeValue timeToValue({required String time}) {
  TimeValue timeValue = TimeValue();
  List<String> timeArray = time.split(":");
  if (timeArray.length == 3) {
    Duration duration = Duration(
        hours: _parseInt(timeArray[0]),
        minutes: _parseInt(timeArray[1]),
        seconds: _parseInt(timeArray[2]));
    timeValue.seconds = duration.inSeconds;
    timeValue.minutes = duration.inMinutes;
    timeValue.hours = duration.inHours;
    timeValue.days = duration.inDays;
  }
  return timeValue;
}