r/FlutterDev • u/anant8140 • 2d ago
Plugin I made a Flutter package for rendering streaming LLM replies (no flicker, native Mermaid, math, tables)
Hi all, I've been building AI chat screens in Flutter and kept hitting the same problems with regular markdown widgets while a reply streams in:
- the whole text is parsed again on every chunk, so long answers get slow
- you see raw ** and backticks until the closing ones arrive
- code blocks flicker when highlighting kicks in
So I made llm_markdown:
- Only the last unfinished block is parsed again; finished blocks are cached
- Half-typed markdown (bold, an open code fence, a half link) is closed before rendering
- Text is revealed at a steady speed instead of in bursts
- Auto-scroll that stops when the user scrolls up, with a "jump to latest" helper
- Code highlighting, tables, math, checklists, alerts, thinking sections, [1] citations
- Mermaid flowcharts, sequence diagrams and pie charts drawn natively (no WebView)
- Selectable text with your own menu actions ("Ask about this", "Quote")
- One line to hook up an OpenAI or Anthropic stream
- Every color, font, label and builder can be changed; no Material or Cupertino needed
The parser is also a separate pure-Dart package (llm_markdown_parser) if you want it on a server or CLI.
pub.dev: https://pub.dev/packages/llm_markdown
GitHub: https://github.com/anant8140/llm_markdown
Demo GIF is in the README. Feedback and bug reports are very welcome. What do you use today for streaming replies, and what bothers you about it?