StreamingTextController class

Controller for programmatically controlling StreamingText animations.

This controller provides methods to pause, resume, restart, and skip animations. Perfect for LLM applications where users need control over text streaming behavior.

Example usage:

final controller = StreamingTextController();

StreamingTextMarkdown(
  text: llmResponse,
  controller: controller,
)

// Pause the animation
controller.pause();

// Resume from where it was paused
controller.resume();

// Skip to the end immediately
controller.skipToEnd();
Inheritance

Constructors

StreamingTextController()
Creates a controller in the StreamingTextState.idle state.

Properties

error → Object?
The error that caused an error state, or null if there isn't one.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
isAnimating → bool
Whether the animation is currently running
no setter
isCompleted → bool
Whether the animation has completed
no setter
isPaused → bool
Whether the animation is currently paused
no setter
isStreaming → bool
Whether text is still arriving or still being revealed.
no setter
markdown → String
The full source text of the bound widget, for copy.
no setter
progress → double
Current progress of the animation (0.0 to 1.0)
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
speedMultiplier ↔ double
Speed multiplier for the animation
getter/setter pair
state → StreamingTextState
Current state of the streaming animation
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
copyToClipboard() → Future<void>
Copies markdown to the system clipboard.
dispose() → void
Discards any resources used by the object.
override
markCompleted() → void
Internal method to mark as completed.
markError(Object error, [StackTrace? stackTrace]) → void
Marks an error state.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
onCompleted(VoidCallback callback) → void
Sets a callback for when the animation completes.
onProgressChanged(void callback(double)) → void
Sets a callback for when the animation progress changes.
onStateChanged(void callback(StreamingTextState)) → void
Sets a callback for when the animation state changes.
pause() → void
Pauses the animation
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
restart() → void
Restarts the animation from the beginning.
resume() → void
Resumes the animation from where it was paused
skipToEnd() → void
Skips to the end of the animation immediately.
stop() → void
Stops the animation and resets to idle state.
toString() → String
A string representation of this object.
inherited
updateProgress(double newProgress) → void
Internal method to update progress.
updateSource(String source, {required bool inputClosed}) → void
Internal method to publish the current source snapshot.
updateState(StreamingTextState newState) → void
Internal method to update the state.

Operators

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