LoadingSpinner class

Theme-aware loading spinner with multiple visual styles.

Styles: dots (braille), bars (rising/falling), arcs (quarter/half circles).

Usage:

  1. Static display (caller controls updates):
final spinner = LoadingSpinner('Loading');
spinner.show(frame: 0);
// ... do work ...
spinner.show(frame: 1);
spinner.clear();
  1. With callback (caller drives progress):
LoadingSpinner('Processing').runWith((tick) {
  for (int i = 0; i < 10; i++) {
    doWork();
    tick();
  }
});

Constructors

LoadingSpinner(String prompt, {String message = 'Loading', SpinnerStyle style = SpinnerStyle.dots, PromptTheme theme = PromptTheme.dark})
Creates a loading spinner.

Properties

hashCode int
The hash code for this object.
no setterinherited
message String
The text displayed next to the spinner.
final
prompt String
The label displayed above the spinner.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
style SpinnerStyle
The visual appearance of the spinner.
final
theme PromptTheme
The theme controlling the colors used for the spinner and text.
final

Methods

clear() → void
Clears the indicator from the terminal and resets internal state.
inherited
initializeAutomatically() → void
Captures the ambient terminal and its automatically detected execution mode for a directly constructed indicator.
inherited
initializeFromTerminice(Terminice origin) → void
Captures the terminal and execution policy for a factory-created indicator.
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
renderIndicator(String plainLine, void renderRich(RenderOutput output)) → void
Renders one indicator update according to the captured execution policy.
inherited
runSession(void body(), {required String plainStart, required String plainSuccess}) → void
Runs a callback inside a cursor-hidden terminal session, calling clear when the callback finishes.
inherited
runTaskSession<T>(Future<T> run(Terminal terminal, TerminiceFallbackMode directFallbackMode), {required String plainStart}) Future<T>
Adds the one start line required by task-like indicator sugar while the existing task renderer remains responsible for its single final line.
inherited
runWith(void callback(void tick())) → void
Runs the spinner with a callback that provides tick updates.
show(int frame) → void
Shows the spinner at the given frame.
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 run while showing this spinner and returns its typed result.

Operators

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