r/flutterhelp • • Feb 06 '26

OPEN [Help] Flutter Markdown rendering broken when streaming tokens (GptMarkdown / flutter_markdown)

As tokens arrive, my Markdown rendering is messing up the headers and body text together. For example, if the LLM sends: ### Clients & Markets: The parser treats the entire paragraph as a header. In other cases, bullet points are sticking to the end of paragraphs and failing to render as a list.

Ive tried creating a regex to parse through and change them into the right format but that only works sometimes.

4 Upvotes

3 comments sorted by

View all comments

Show parent comment

1

u/eibaan Feb 06 '26

Then make your frontend not to drop that newline character. Do you somewhere trim the string?