RecurrenceSpec constructor

const RecurrenceSpec(
  1. RecurrenceFrequency frequency, {
  2. int interval = 1,
  3. int? weekday,
  4. int? weekOfMonth,
  5. int? monthDay,
  6. int? month,
})

Creates a spec. interval is the "every N" multiplier (default 1) and must be >= 1 — a zero or negative interval has no meaning ("every 0 days").

Validation is an initializer-list assert (matching the sibling value types OpenWindow/QuietWindow): throwing from the constructor body would leave a partially built object, so a bad interval is treated as a programming error caught in debug rather than a recoverable runtime fault. Audited: 2026-06-12 11:26 EDT

Implementation

const RecurrenceSpec(
  this.frequency, {
  this.interval = 1,
  this.weekday,
  this.weekOfMonth,
  this.monthDay,
  this.month,
}) : assert(interval >= 1, 'interval must be >= 1');