Offset.duration constructor
Offset.duration(
- Duration duration
Converts the given Duration to an offset, with fractional seconds truncated.
duration
: The Duration to convert
Returns: An offset for the same time as the given time span.
- RangeError: The given time span falls outside the range of +/- 18 hours.
Implementation
factory Offset.duration(Duration duration) {
int seconds = duration.inSeconds;
Preconditions.checkArgumentRange('duration', seconds, _minSeconds, _maxSeconds);
return Offset(seconds);
}