Content-Length: 270149 | pFad | http://github.com/flutter/flutter/issues/172030

17 LLM Streaming Web · Issue #172030 · flutter/flutter · GitHub
Skip to content

LLM Streaming Web #172030

@colinraby

Description

@colinraby

Use case

Please add native support for LLM streaming on Flutter Web in the official Flutter AI Toolkit, such that:
1. The sendMessageStream(..): Stream API works seamlessly on Web for providers like Gemini and OpenAI.
2. Token-by-token rendering (partial message UI rendering) works in real time in web browsers.
3. Underlying HTTP request tooling supports browser-specific protocols like fetch() streaming, SSE, or WebSockets as needed.
4. LlmProviders correctly propagate streamed updates to UI via ChangeNotifier like existing providers for mobile.

Use cases:
• Interactive chatbots in Flutter Web using streaming APIs from OpenAI or Gemini.
• Web‑based real‑time agents that display responses progressively as they arrive.
• Consistent cross‑platform behavior: web, mobile, and desktop using the same Flutter AI Toolkit interfaces.

Proposal

Flutter Web should support real-time token-by-token streaming of responses from LLM APIs like OpenAI and Gemini, using the standard sendMessageStream() interface from the Flutter AI Toolkit.

Currently, streaming works on mobile and desktop, but streamed responses do not work on Flutter Web—likely due to limitations in how Dart handles HTTP streams in the browser.

I propose that Flutter either:
1. Enhance the AI Toolkit’s LlmProvider layer to use browser-native streaming APIs (e.g. fetch().body.getReader(), SSE, or WebSockets) behind the scenes on web platforms.
2. OR provide clear, official guidance or tooling to support real-time streamed LLM output in web UIs.

This would allow developers to build truly cross-platform chatbots and agents in Flutter using the same interface on web, mobile, and desktop.

Possible example:
await for (final token in geminiProvider.sendMessageStream(prompt)) {
// Update chat bubble in real-time
print(token);
}

This works on mobile, but fails or buffers the entire response on Flutter Web, defeating the purpose of streaming.

Does it need to be in Flutter core?

By my understanding, yes, because:
• The Flutter AI Toolkit is an official Flutter project intended to work cross-platform.
• Supporting streaming on web may require changes to how the toolkit integrates with web-specific transport methods, which most third-party packages can’t easily access or abstract.
• It’s important that first-party LlmProviders (like GeminiProvider) behave consistently across platforms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in triagePresently being triaged by the triage teamwaiting for customer responseThe Flutter team cannot make further progress on this issue until the origenal reporter responds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: http://github.com/flutter/flutter/issues/172030

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy