ProgressDots class
Frame-based dots indicator for ambient progress feedback.
Customize the message that precedes the dots or tune maxDots for longer or shorter animation ramps without changing your rendering loop.
Usage:
- Static display (caller controls updates):
final dots = ProgressDots('Loading');
dots.show(phase: 0);
// ... do work ...
dots.show(phase: 1);
dots.clear();
- With callback (caller provides updates):
ProgressDots('Processing').runWith((tick) {
for (int i = 0; i < 10; i++) {
doWork();
tick();
}
});
Constructors
- ProgressDots(String prompt, {String message = 'Working', int maxDots = 3, PromptTheme theme = PromptTheme.dark})
- Creates a new ProgressDots indicator.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxDots → int
-
The maximum number of dots in the animation sequence.
final
- message → String
-
The text displayed next to the dots.
final
- prompt → String
-
The label displayed above the dots.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- theme → PromptTheme
-
The theme controlling the colors used for the dots and text.
final
Methods
-
clear(
) → void -
Clears the indicator from the terminal and resets internal state.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
prepareFrame(
) → RenderOutput -
Prepares a RenderOutput, clears the previous frame if one was drawn,
and returns the output for the subclass to render into.
inherited
-
runSession(
void body()) → void -
Runs a callback inside a cursor-hidden terminal session, calling
clearwhen the callback finishes.inherited -
runWith(
void callback(void body())) → void - Runs with a callback that provides tick updates.
-
show(
{required int phase}) → void - Shows the dots at the given phase.
-
toString(
) → String -
A string representation of this object.
inherited
-
whileRunning<
T> (FutureOr< T> run(), {String? message, String? success, TaskErrorMessage? failure, TaskErrorMessage? cancel, TaskCancelPredicate? isCanceled, Duration interval = const Duration(milliseconds: 80), TaskDisplay display = TaskDisplay.auto, TaskFinalBehavior finalBehavior = TaskFinalBehavior.persist}) → Future<T> -
Runs
runwhile showing progress dots and returns its typed result.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited