CronScheduledTrigger constructor

CronScheduledTrigger({
  1. int? minute,
  2. int? hour,
  3. int? day,
  4. int? month,
  5. int? weekday,
})

Create a cron scheduled trigger based on specifying:

  • minute - The minute to trigger. int 0-59 or null (= match all).
  • hour - The hour to trigger. int 0-23 or null (= match all).
  • day - The day of the month to trigger. int 1-31 or null (= match all).
  • month - The month to trigger. int 1-12 or null (= match all).
  • weekday - The week day to trigger. int 0-6 or null (= match all).

Implementation

factory CronScheduledTrigger({
  int? minute,
  int? hour,
  int? day,
  int? month,
  int? weekday,
}) {
  assert(
    minute == null || (minute >= 0 && minute <= 59),
    'minute must be in the range of [0-59] or null (=match all).',
  );
  assert(
    hour == null || (hour >= 0 && hour <= 23),
    'hour must be in the range of [0-23] or null (=match all).',
  );
  assert(
    day == null || (day >= 1 && day <= 31),
    'day must be in the range of [1-31] or null (=match all).',
  );
  assert(
    month == null || (month >= 1 && month <= 12),
    'month must be in the range of [1-12] or null (=match all).',
  );
  assert(
    weekday == null || (weekday >= 0 && weekday <= 6),
    'weekday must be in the range of [0-6] or null (=match all).',
  );
  return CronScheduledTrigger._(
    cronExpression: _cronToString(minute, hour, day, month, weekday),
  );
}