counter method
Implementation
StreamSubscription counter(Duration interval, Function(int i) task,
{bool callOI = false}) {
final seeds = List.generate(toInt(), (e) => e);
final stream = Stream.fromIterable(seeds).interval(interval).timeInterval();
stream.doOnCancel(() {
seeds.clear();
});
if (callOI) {
task(0);
}
return stream.listen((i) {
task(i.value);
});
}