Skip to content

RandomRecurrentTrigger

A daily trigger that triggers a random number of times within a defined period of time of the day.

The random value is between the minNumberOfTriggers and maxNumberOfTriggers numbers specified. The time period is defined by a startTime and an endTime.

Inheritance
Implemented types
Annotations

Constructors

RandomRecurrentTrigger.fromJson

RandomRecurrentTrigger.fromJson(
  1. Map<String, dynamic> json
)

RandomRecurrentTrigger

RandomRecurrentTrigger({
  1. int minNumberOfTriggers = 0,
  2. int maxNumberOfTriggers = 1,
  3. TimeOfDay startTime = const TimeOfDay(hour: 8),
  4. TimeOfDay endTime = const TimeOfDay(hour: 20),
})

Creates a RandomRecurrentTrigger.

minNumberOfTriggers and maxNumberOfTriggers specify the range of the random number of triggers (e.g., between 3 and 8 times per day). startTime and endTime specify the period within a day the triggers take place (default is between 08:00 and 20:00). startTime must be before endTime.

Properties

endTime

TimeOfDay endTime
getter/setter pair

End time of the day where the trigger can happen.

fromJsonFunction

Function get fromJsonFunction
override

The function which can convert a JSON string to an object of this type.

lastTriggerTimestamp

DateTime? lastTriggerTimestamp
getter/setter pair

When this trigger last triggered, or null if never.

maxNumberOfTriggers

int maxNumberOfTriggers
getter/setter pair

Maximum number of triggers per day. Default is 1.

minNumberOfTriggers

int minNumberOfTriggers
getter/setter pair

Minimum number of triggers per day. Default is 0.

startTime

TimeOfDay startTime
getter/setter pair

Start time of the day where the trigger can happen.

Methods

toJson

Map<String, dynamic> toJson()
override

Return a JSON encoding of this object.