range2 0.1.1 range2: ^0.1.1 copied to clipboard
Dart2 compatible python-like range() function implemented using sync*.
Usage #
A simple usage example:
import 'package:range2/range2.dart';
main() {
print('${range(1, 5)}'); // (1, 2, 3, 4)
print('${range(1, 10, 3)}'); // (1, 4, 7)
print('${range(-5, 0)}'); // (-5, -4, -3, -2, -1)
print('${range(-5, -10, -1)}'); // (-5, -6, -7, -8, -9)
for (var n in range(1, 10, 2)) {
print(n);
}
// 1
// 3
// 5
// 7
// 9
}
Features and bugs #
Please file feature requests and bugs at the issue tracker.