timeToValue static method
convert time to value seconds, minutes, hours, days
time HH:mm:ss
Implementation
static TimeValue timeToValue({required String time}) {
TimeValue timeValue = TimeValue();
List<String> timeArray = time.split(":");
if (timeArray.length > 2) {
Duration duration = Duration(
hours: _parseInt(timeArray[0]),
minutes: _parseInt(timeArray[1]),
seconds: _parseInt(timeArray[2]));
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;
}