Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demos: Replace setState with StreamBuilder where appropriate #257

Merged
merged 2 commits into from
Mar 24, 2025

Conversation

simolus3
Copy link
Contributor

Some pages in the demo apps create a stream subscription and use setState() when receiving new snapshots to render content. This refactors most of these usages to use Flutter's StreamBuilder widget. Using stream builders makes it impossible to leak resources (the widget will stop listening to the stream when removed from the tree) and requires much less boilerplate code.

@simolus3 simolus3 requested a review from stevensJourney March 21, 2025 15:12
Copy link
Contributor

@rkistner rkistner left a comment

Choose a reason for hiding this comment

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

Thanks, this is much cleaner!

@simolus3 simolus3 merged commit 263dd47 into main Mar 24, 2025
5 checks passed
@simolus3 simolus3 deleted the demo-state-refactoring branch March 24, 2025 07:07
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