LLMStreamingResult
Flutter Widget Example
Cancellation
Cancel ongoing generation at any time:Best Practices
- Update UI incrementally — Append tokens to your state as they arrive
- Show a cancel button — Let users stop long generations
- Handle cancellation gracefully — The stream will complete when cancelled
- Get final metrics — Always await
resultfor accurate performance data
See Also
chat()
Simple one-liner
generate()
Non-streaming with metrics