TickMsg class

Message sent when a timer tick occurs.

Created by Cmd.tick commands. Contains the time when the tick occurred and an optional identifier for distinguishing between multiple timers.

Example

@override
Cmd? init() => Cmd.tick(Duration(seconds: 1), (_) => TickMsg(DateTime.now()));

@override
(Model, Cmd?) update(Msg msg) {
  return switch (msg) {
    TickMsg(:final time) => (
      copyWith(lastTick: time),
      Cmd.tick(Duration(seconds: 1), (_) => TickMsg(DateTime.now())),
    ),
    _ => (this, null),
  };
}
Inheritance

Constructors

TickMsg(DateTime time, {Object? id})
Creates a tick message.
const

Properties

dropWhenInputQueued bool
Whether this message can be dropped when fresher user input is queued.
no setterinherited
hashCode int
The hash code for this object.
no setteroverride
id Object?
Optional identifier for the timer.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
time DateTime
The time when the tick occurred.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override