flutter_streaming_text_markdown library
A Flutter package for displaying streaming text with Markdown support.
This package provides widgets for creating animated text displays with markdown formatting. It's perfect for creating typing animations, chat interfaces, or any text that needs to appear gradually with style.
The main widget is StreamingTextMarkdown, which combines markdown rendering with customizable typing animations.
Example usage:
StreamingTextMarkdown(
text: '''# Welcome! 👋
This is a **demo** of streaming text with *markdown* support.''',
typingSpeed: Duration(milliseconds: 50),
fadeInEnabled: true,
)
Classes
- CodeBlockTheme
- Immutable theme for fenced code blocks and their syntax highlighting.
- CodeBlockView
- A self-contained code block: optional header (language label + copy button) above horizontally-scrollable, syntax-highlighted code.
- DefaultStreamProvider
- A professional default implementation of StreamProvider.
- GptMarkdownStyleSheet
- Per-component appearance, in one object.
- InlineCodeStyle
-
How inline
codeis drawn. - InlineDirective
- A host-defined inline region the Markdown parser must not look inside.
- InlinePattern
- A consumer-defined inline syntax, matched and rendered alongside the built-in Markdown components.
- LLMAnimationPresets
- Animation presets optimized for LLM text streaming.
- MarkdownBlockComponent
- Registers a syntax and its renderer on the modern cached pipeline.
- MarkdownComponent
- Markdown components
- MarkdownRenderOptions
-
Bundles the
gpt_markdown1.3 pass-throughs that don't already have a dedicated StreamingText/StreamingTextMarkdown parameter. - StreamConfig
- Professional configuration for stream providers.
- StreamData
- Professional representation of streaming data.
- StreamingShimmer
- A shimmer/skeleton loading widget for use while waiting for the first LLM token to arrive (TTFT — Time To First Token).
- StreamingText
- A widget that displays streaming text with real-time updates and markdown support.
- StreamingTextConfig
- Configuration class for streaming text animations
- StreamingTextController
- Controller for programmatically controlling StreamingText animations.
- StreamingTextMarkdown
- A widget that displays streaming text with Markdown support.
- StreamingTextTheme
- Theme extension for StreamingTextMarkdown widget
- StreamPacing
-
How a RevealMode-driven reveal paces a
Stream<String>(or statictext) source (DESIGN.md 4.3). - StreamProvider
- A professional interface for handling streaming data in AI applications.
Enums
- AnimationSpeed
- Speed presets for quick configuration
- RevealMode
- How revealed text arrives on screen (DESIGN.md section 4).
- StreamDataType
- Professional enumeration of stream data types.
- StreamingTextState
- Represents the current state of a streaming text animation
Extensions
- StreamingTextStateExtension on StreamingTextState
- Extension methods for StreamingTextState
- StreamingTextThemeExtension on BuildContext
- Extension method to easily access StreamingTextTheme from BuildContext
Typedefs
- BlockQuoteBuilder = Widget Function(BuildContext context, Widget content, BlockQuoteStyle style)
- Builds the widget for a blockquote.
- CheckboxBuilder = Widget Function(BuildContext context, bool checked, Widget content, CheckboxStyle style)
- Builds the widget for a task-list checkbox and its label.
- HeadingBuilder = Widget Function(BuildContext context, int level, Widget content, HeadingStyle style)
-
Builds the widget for a
#heading. - HrBuilder = Widget Function(BuildContext context, HrStyle style)
- Builds the widget for a horizontal rule.
- ImageBuilder = Widget Function(BuildContext context, String imageUrl, double? width, double? height)
- A builder function for the image.
- InlineCodeBuilder = InlineSpan Function(BuildContext context, String code, TextStyle style, InlineCodeStyle codeStyle)
-
Builds the span for one run of inline
`code`. - InlineLinkBuilder = InlineSpan Function(LinkBuildDetails details)
-
Builds the span for one
[label](url)link or autolink. - InlineSourceTagBuilder = InlineSpan Function(SourceTagBuildDetails details)
-
Builds the span for one
[1]citation chip. - OrderedListBuilder = Widget Function(BuildContext context, String no, Widget child, GptMarkdownConfig config)
- A builder function for the ordered list.
- RadioOptionBuilder = Widget Function(BuildContext context, bool checked, Widget content, CheckboxStyle style)
- Builds the widget for a radio option and its label.
-
TableBuilder
= Widget Function(BuildContext context, List<
CustomTableRow> tableRows, TextStyle textStyle, GptMarkdownConfig config) - A builder function for the table.
- UnOrderedListBuilder = Widget Function(BuildContext context, Widget child, GptMarkdownConfig config)
- A builder function for the unordered list.
Exceptions / Errors
- StreamException
- Professional exception class for stream-related errors.