FrameTickMsg class
Message sent automatically by the TUI runtime every frame.
When ProgramOptions.frameTick is enabled (default), the runtime sends this message at the configured ProgramOptions.fps rate. This drives animations and continuous updates without requiring each application to set up its own tick loop.
The message contains:
- time - When the frame tick occurred
- frameNumber - Monotonically increasing frame counter
- delta - Time since the last frame (useful for smooth animations)
Example
@override
(Model, Cmd?) update(Msg msg) {
return switch (msg) {
FrameTickMsg(:final time, :final delta) => (
copyWith(
animationProgress: animationProgress + delta.inMilliseconds / 1000.0,
lastFrameTime: time,
),
null,
),
_ => (this, null),
};
}
Disabling Frame Ticks
For static UIs that don't need continuous updates, disable frame ticks:
final program = Program(
MyModel(),
options: ProgramOptions(frameTick: false),
);
Constructors
- FrameTickMsg({required DateTime time, required int frameNumber, required Duration delta})
-
Creates a frame tick message.
const
Properties
- delta → Duration
-
Duration since the last frame tick.
final
- frameNumber → int
-
Monotonically increasing frame counter.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- time → DateTime
-
The time when this frame 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