CronExpression class
A standard 5 fields cron expression: minute hour day-of-month month day-of-week.
- Each field accepts
*, values, lists (1,15), ranges (1-5) and steps (*/15,0-30/10,5/10). - Months accept names (
JAN-DEC) and days of week names (SUN-SAT); day of week0and7are Sunday. - When both day of month and day of week are restricted (not
*), a day matches if any of them matches (standard cron behavior). - Macros:
@yearly(@annually),@monthly,@weekly,@daily(@midnight) and@hourly.
The times are matched in the wall clock of a time zone (nextAfter, previousBefore): a time that doesn't exist (a daylight saving gap) runs at the first valid instant after it, and a repeated time (the clock set back) runs only once.
Constructors
- CronExpression.parse(String expression)
-
Parses
expression. Throws a FormatException if invalid.factory
Properties
-
daysOfMonth
→ Set<
int> -
final
-
daysOfWeek
→ Set<
int> -
Days of week:
0(Sunday) to6(Saturday).final - expression → String
-
The expression, as given.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
-
hours
→ Set<
int> -
final
-
minutes
→ Set<
int> -
final
-
months
→ Set<
int> -
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
matches(
DateTime wall) → bool -
Returns
trueif the wall clock timewall(its fields; seconds are ignored) matches this expression. -
nextAfter(
DateTime from, [Location? location]) → TZDateTime? -
The next time after
from(exclusive) that matches this expression inlocation(defaultUTC), ornullif none in maxSearchYears. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
previousBefore(
DateTime to, [Location? location]) → TZDateTime? -
The latest time not after
to(inclusive) that matches this expression inlocation(defaultUTC), ornullif none in maxSearchYears. -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
tryParse(
String? expression) → CronExpression? -
Parses
expression, or returnsnullif invalid.
Constants
- maxSearchYears → const int
-
The maximum wall clock span searched by nextAfter and
previousBefore (an expression like
0 0 30 2 *never matches).