until<T> function
Iterable<T>
until<
T>( - T stop, [
- T? step
])
Implementation
Iterable<T> until<T>(T stop, [T? step]) {
if (T == int) {
return IntRange.until(stop as int, (step as num?)?.toInt() ?? 1)
as Iterable<T>;
} else if (T == double) {
return DoubleRange.until(stop as double, (step as num?)?.toDouble() ?? 1.0)
as Iterable<T>;
} else if (T == Duration) {
return DurationRange.until(
stop as Duration, step as Duration? ?? Duration(seconds: 1))
as Iterable<T>;
} else if (stop.runtimeType == int) {
return IntRange.until(stop as int, (step as num?)?.toInt() ?? 1)
as Iterable<T>;
} else if (stop.runtimeType == double) {
return DoubleRange.until(stop as double, (step as num?)?.toDouble() ?? 1.0)
as Iterable<T>;
}
// TODO TimeRange
throw Exception('Unknown type $T');
}