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

fix: prevent early dispose of CardSwiperController #38

Conversation

Kal-Elx
Copy link
Contributor

@Kal-Elx Kal-Elx commented May 3, 2024

First of all, thanks for great package 🚀

Description

I was facing the issue that the CardSwiperController I saved in my state stopped working when the CardSwiper in the child widget was rebuilt. When calling a method upon the CardSwiperController I received an error saying that the underlying stream was closed.

When investigating the code I discovered that CardSwiper is calling dispose on the CardSwiperController that was passed in as a parameter leading to the closing of the stream. My belief is that it's not the responsibility of CardSwiper to dispose of CardSwiperController since this widget did not create the controller. Instead it should be disposed by the parent widget that is passing CardSwiperController to CardSwiper, as it's done in example/lib/main.dart.

This commit fixed the issue for me.

Pre-launch Checklist

Copy link
Owner

@ricardodalarme ricardodalarme left a comment

Choose a reason for hiding this comment

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

Nice one!

@ricardodalarme ricardodalarme merged commit 3b0796c into ricardodalarme:main May 6, 2024
2 checks passed
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