getSchedule method

  1. @override
List<DateTime> getSchedule(
  1. DateTime from,
  2. DateTime to, [
  3. int max = 100
])
override

Returns the times this trigger fires between from and to.

Ordered by time, except for RandomRecurrentTriggerExecutor.

max limits the number of iterations; its default depends on the implementation.

Implementation

@override
List<DateTime> getSchedule(DateTime from, DateTime to, [int max = 100]) {
  var cronIterator = Cron().parse(
    configuration!.cronExpression,
    Settings().timezone,
    tz.TZDateTime.from(from, tz.getLocation(Settings().timezone)),
  );
  final List<DateTime> schedule = [];
  int count = 0;

  while (cronIterator.next().isBefore(to) && count < max) {
    schedule.add(cronIterator.current());
    count++;
  }
  return schedule;
}