Countdown<T> class Null safety

Countdown to a given completion DateTime.

On creation it can also be indicated if after the initial countdown the completion repeats at a specific duration. One or more milestones may be associated with the countdown completion using a map of the event to the Duration of the milestone completion from the countdown completion

Implementers

Constructors

Countdown({required T event, required DateTime completion, CountdownRepeat? repeats, Map<T, Duration> withMilestones = const {}})
Creates a new countdown

Properties

completed BehaviorSubject<bool>
Has countdown completed
final
completesIn Stream<Duration>
Emits the duration to completion every second
read-only
completion DateTime
Time of completion
read-only
completion$ Rx<DateTime>
Observable completion
read / write
event → T
Event occuring at the end of the countdown
final
hashCode int
The hash code for this object. [...]
read-only, inherited
initialCompletion DateTime
Initial time of completion
final
isCompleted → dynamic
Has the completion time passed
read-only
isNotCompleted → dynamic
Has the completion time not passed
read-only
milestones Map<T, CountdownMilestone<T>>
Milestones relative to the completion
final
repeats CountdownRepeat?
Duration until the completion of the next instance of this countdown when the current countdown is completed
@JsonKey(toJson: CountdownRepeat.repeatToJson), read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
storage SimpleStorage<String>
Storage for completion overrides
read / write
withMilestones Map<T, Duration>
Map of event names to the Duration from the completion to the milestone TODO: Allow this to take a function to calculate the final date time from the countdown completion datetime
final

Methods

milestoneCompletedFor(T event) bool
Returns if the milestone for the given event has completed
milestoneFor(T event) Countdown<T>?
Get the milestone for the given event
milestoneNotCompletedFor(T event) bool
Returns if the milestone for the given event has not been completed
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
restoreInitialCompletion() Future<void>
Restore inital completion date time
setNextCompletion(int sinceCompletion) Future<void>
Calculates the time of next completion with the duration sinceCompletion
toString() String
A string representation of this object. [...]
inherited
updateCompletion(DateTime completion) Future<void>
Time of completion

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited