stepTo method

Iterable<Hora> stepTo(
  1. Hora end, {
  2. required TimePrecision precision,
})

Generates dates between this and another at the given precision.

Implementation

Iterable<Hora> stepTo(Hora end, {required TimePrecision precision}) sync* {
  final step = isBefore(end) ? 1 : -1;
  var current = this;

  while (step > 0 ? !current.isAfter(end) : !current.isBefore(end)) {
    yield current;
    current = current.add(step, precision.toUnit);
  }
}