timer_builder library
Classes
- TimerBuilder
- A widget that rebuilds on specific and / or periodic Timer events.
Functions
-
alignDateTime(
DateTime dt, Duration alignment, [bool roundUp = false]) → DateTime -
Rounds down or up a DateTime object using a Duration object.
If
roundUp
is true, the result is rounded up, otherwise it's rounded down. If the duration is a multiple of days, the result will be aligned at the day mark in the timezone of the source datetime. -
createTimerStream(
TimerGenerator generator, Future stopSignal) → Stream< DateTime> -
Creates a stream tha produces DateTime objects at the times specified by the
generator
. Stops the stream whenstopSignal
is received. -
fromIterable(
Iterable< DateTime> iterable) → TimerGenerator -
getAlignmentUnit(
Duration interval) → Duration - Returns an alignment unit can be passed to alignDateTime in order to align the date/time units. For example, if the specified interval is 15 minutes, the alignment unit is 1 minute.
-
periodicTimer(
Duration interval, {Duration alignment = Duration.zero}) → TimerGenerator -
scheduledTimer(
Iterable< DateTime> schedule) → TimerGenerator
Typedefs
- TimerGenerator = DateTime? Function(DateTime now)
- Used by TimerBuilder to determine the next DateTime to trigger a rebuild on