range method
Implementation
Iterable<E> range(step) {
if (E == int) {
return IntRange(lower as int, upper as int, step) as Iterable<E>;
} else if (E == double) {
return DoubleRange(lower as double, upper as double, step) as Iterable<E>;
} else if (E == DateTime) {
if (step is Duration) {
return TimeRange(lower as DateTime, upper as DateTime, step)
as Iterable<E>;
} else if (step is int) {
return MonthRange(lower as DateTime, upper as DateTime, step)
as Iterable<E>;
} else {
throw UnsupportedError(
'step must be int or Duration for time range. but found $E');
}
}
throw UnsupportedError('range is not supported for $E');
}