nextMatching method

Hora? nextMatching(
  1. bool filter(
    1. Hora
    ), {
  2. int maxDays = 365,
})

Gets the next occurrence that matches a filter.

Implementation

Hora? nextMatching(bool Function(Hora) filter, {int maxDays = 365}) {
  var current = this;
  for (var i = 0; i < maxDays; i++) {
    current = current.add(1, TemporalUnit.day);
    if (filter(current)) return current;
  }
  return null;
}