TimeRange constructor
Returns an iterable of integers from start
inclusive to stop
inclusive
with step
.
TimeRange(DateTime(2019, 1, 1), DateTime(2019, 1, 20), Duration(days: 1))
Implementation
factory TimeRange(DateTime start, DateTime stop, Duration step) {
if (step.isNegative) {
throw ArgumentError.value(step, 'step', 'Must be greater than 0');
}
if (stop.isBefore(start)) step = -step;
return TimeRange._(start, stop, step);
}