You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .cursor/rules/6-streaming-text-message.mdc
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ The library itself does not dictate state management for streams. The example pr
29
29
* It requires the `ChatController` instance.
30
30
* **Finalization:** Upon stream completion or error, the manager:
31
31
* Waits for a duration matching the UI animation (`chunkAnimationDuration`).
32
-
* Calls `chatController.update(originalStreamMessage, finalTextMessage)` to replace the `TextStreamMessage` with a standard `TextMessage` in the data source.
32
+
* Calls `chatController.updateMessage(originalStreamMessage, finalTextMessage)` to replace the `TextStreamMessage` with a standard `TextMessage` in the data source.
33
33
* Cleans up its internal state for that `streamId`.
34
34
* **Integration:** The example ([gemini.dart](mdc:examples/flyer_chat/lib/gemini.dart)) provides the manager via `ChangeNotifierProvider` and uses `context.watch` within the `textStreamMessageBuilder` to get the current `StreamState` for the widget.
35
35
@@ -40,7 +40,7 @@ The library itself does not dictate state management for streams. The example pr
40
40
3. The external manager is notified (`startStream`).
41
41
4. Subsequent chunks are sent to the manager (`addChunk`), which updates its state and notifies listeners.
42
42
5. The `FlyerChatTextStreamMessage` widget rebuilds via `context.watch`, receives the new `StreamState`, detects the new chunk in `didUpdateWidget`, and initiates the animation for that chunk.
43
-
6. When the stream ends, the manager (`completeStream`/`errorStream`) delays, then calls `chatController.update`.
43
+
6. When the stream ends, the manager (`completeStream`/`errorStream`) delays, then calls `chatController.updateMessage`.
44
44
7. The `ChatAnimatedList` reacts to the controller update, eventually causing `ChatMessageInternal` to rebuild with the final `TextMessage`, which is then rendered by the `textMessageBuilder`.
45
45
46
46
This approach ensures animations occur inline, the UI handles list recycling gracefully, and the final message state is persisted correctly via the controller.
0 commit comments