Skip to content

Remove the deprecated stream extension - #110

Open
KamilSztandur wants to merge 2 commits into
after-first-unfocusfrom
remove-stream-extension
Open

KamilSztandur wants to merge 2 commits into
after-first-unfocusfrom
remove-stream-extension

Conversation

@KamilSztandur

Copy link
Copy Markdown
Collaborator

Problem

AdvancedFieldController.stream was 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 addListener and removeListener in a broadcast StreamController, stored in a field so it is created once.

Stacked on #103; merge after it.

🤖 Generated with Claude Code

Comment thread MIGRATION.md Outdated
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;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 🤔

@KamilSztandur KamilSztandur Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point

KamilSztandur and others added 2 commits October 24, 2026 15:50
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
KamilSztandur force-pushed the remove-stream-extension branch from b56bfbf to 0618bbc Compare October 24, 2026 13:50
@KamilSztandur
KamilSztandur added this pull request to stack #112 October 24, 2026 13:50
@github-actions

Copy link
Copy Markdown

Docs preview: https://advanced-forms-7jppnlyrv-leancode.vercel.app

Built from 0618bbc; the landing page is at /, the docs under /docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants