I have a double value which is a number of hours that I need to convert it to Duration. Suppose I have a function prototype like this
Duration parseDurationFromDouble(double d) {
// parse the double
return parsedDuration;
}
and
2.5
as my duration stored in double, then the function should return, like this:
Duration(hours: 2, minutes: 30)
How to do this in Dart? Can I convert it directly? Or should I done this through String interpolation?
Thanks in advance.
Duration(minutes: (hoursDuration * 60).toInt());