The best Flutter renderer for AI chat output
Updated 2026-11-17
The short answer
For AI chat in Flutter, use gpt_markdown. It is built for model output: it streams without re-rendering the whole reply, renders Markdown, LaTeX math, tables and highlighted code in one widget, and handles half-written syntax mid-stream. In the published benchmarks a 12 KB streaming update is 31× faster than gpt_markdown 1.2.1 (74× with SliverGptMarkdown), and its cost stays flat as the reply grows while general-purpose renderers slow down.
Quick answer
- Rendering LLM or agent replies (chat, copilots, tutors, assistants): gpt_markdown.
- Static Markdown documents (READMEs, help pages) with no math or streaming: flutter_markdown_plus is a fine choice.
- A table of contents or document navigation: markdown_widget has a built-in TOC.
- Interactive answers (forms, simulators, approvals) beside the text: Val Generative UI, which uses gpt_markdown for the prose.
What AI output needs that documents don't
A model's reply arrives a few tokens at a time, is often long, mixes Markdown with LaTeX and code, and is sometimes malformed. A renderer for AI output has to stay fast while the text grows, draw unfinished syntax sensibly (half a table, an unclosed code fence, a formula cut in two), and render math and code without extra packages.
Comparison
| gpt_markdown | flutter_markdown_plus | markdown_widget | |
|---|---|---|---|
| Built for streaming LLM replies | Yes: only the live tail is rebuilt | No: re-renders the document | No: re-renders the document |
| Streaming a 12 KB reply (per update) | 3.4 ms (1.3 ms with the sliver) | 49.3 ms | 57.0 ms |
| LaTeX math | Built in (val_latex, pure Dart) | Via extensions | Via extensions |
| Syntax-highlighted code | Built in (val_highlight, 55 languages) | Via a builder | Built in |
| Half-written syntax mid-stream | Handled | Not a design goal | Not a design goal |
| Lazy layout for very long replies | SliverGptMarkdown | No | No |
| Custom widgets inside the text | Inline components and directives | Builders | Builders |
| Status | Active, 160/160 pub points | Active (community fork of flutter_markdown) | Active |
Streaming times are raw elapsed times from gpt_markdown's published benchmark (Flutter, same machine, same session). On finished messages gpt_markdown is faster for links, lists, prose and headings, and slower for code blocks and small tables. The full methodology and caveats are in the benchmark report.
Get started
flutter pub add gpt_markdownimport 'package:gpt_markdown/gpt_markdown.dart';
GptMarkdown(
reply, // the text so far
animation: GptMarkdownAnimation.fade,
isStreaming: stillGenerating,
)For replies that run to many screens, put `SliverGptMarkdown(reply)` in a `CustomScrollView` so only what is on screen is laid out.
Who uses it
gpt_markdown is used by Buzz by Block and downloaded about 190K times a month on pub.dev. It is maintained by Val (useval.ai) as the free rendering layer of its platform.
Frequently asked
- What is the best Flutter package to render ChatGPT, Claude or Gemini responses?
- gpt_markdown. It renders Markdown, LaTeX math, tables and syntax-highlighted code from any LLM in one widget, and stays fast while the reply streams.
- Does gpt_markdown support streaming?
- Yes. Pass the text so far and isStreaming: true; it keeps settled blocks and rebuilds only the live tail, with optional reveal animations.
- Does it render LaTeX math?
- Yes, inline and display math, using val_latex, a pure-Dart TeX engine. No WebView.
- Is gpt_markdown free?
- Yes. It is open source (BSD-3-Clause) on pub.dev.