Repository navigation
Remove the deprecated stream extension - #110
Open
KamilSztandur wants to merge 2 commits into
Open
KamilSztandur wants to merge 2 commits into
KamilSztandur wants to merge 2 commits into
Conversation
KamilSztandur
requested review from
PiotrRogulski and
mateusz-pietras
as code owners
October 24, 2026 13:39
KamilSztandur
force-pushed
the
remove-stream-extension
branch
from
October 24, 2026 13:40
5e207b4 to
ab21cf4
Compare
Open
Comment on lines
+476
to
+486
| Stream<AdvancedFieldState<T, E>> statesOf<T, E extends Object>( | ||
| AdvancedFieldController<T, E> field, | ||
| ) { | ||
| late final StreamController<AdvancedFieldState<T, E>> controller; | ||
| void listener() => controller.add(field.value); | ||
| controller = StreamController.broadcast( | ||
| onListen: () => field.addListener(listener), | ||
| onCancel: () => field.removeListener(listener), | ||
| ); | ||
| return controller.stream; | ||
| } |
Member
There was a problem hiding this comment.
I don't know if this is the exact snippet we want to recommend to people. For example, it doesn't allow closing the controller 🤔
Collaborator
Author
There was a problem hiding this comment.
Fair point
AdvancedFieldController.stream was the migration bridge for 0.1.x cubit streams, deprecated in 0.2.0 with removal announced for 0.3.0. This is 0.3.0. The migration guide keeps a recipe for the one case that needs a stream: wrap addListener/removeListener in a broadcast StreamController and keep the stream in a field. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A bare stream-returning function left no way to close the controller, so an await-for loop never ended. The recipe is now a small adapter with close(), called from dispose(), which is what Cubit.close() did. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
KamilSztandur
force-pushed
the
remove-stream-extension
branch
from
October 24, 2026 13:50
b56bfbf to
0618bbc
Compare
KamilSztandur
added this pull request to stack #112
October 24, 2026 13:50
|
Docs preview: https://advanced-forms-7jppnlyrv-leancode.vercel.app Built from 0618bbc; the landing page is at |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
AdvancedFieldController.streamwas the migration bridge for 0.1.x cubit streams. It was deprecated in 0.2.0 with removal announced for 0.3.0, and 0.3.0 is the next release.Solution
The extension and its test are gone, and the export with them. The migration guide, the docs migration page and the FAQ now say it was removed, and the guide keeps a short recipe for the one case that still needs a stream: wrap
addListenerandremoveListenerin a broadcastStreamController, stored in a field so it is created once.Stacked on #103; merge after it.
🤖 Generated with Claude Code