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

Track controller stream subscription and cancel on dispose #43

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ltOgt
Copy link

@ltOgt ltOgt commented Aug 17, 2024

Description

// init:
controllerSubscription = widget.controller?.events.listen(_controllerListener);

// dispose:
controllerSubscription?.cancel();

Related Issues

Fixes:

Unhandled Exception: This widget has been unmounted, so the State no longer has a context (and should be considered defunct).
Consider canceling any active work during "dispose" or using the "mounted" getter to determine if the State is still active.

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I updated pubspec.yaml with an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes].
  • I updated CHANGELOG.md to add a description of the change, [following repository CHANGELOG style].
  • [-] I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.

Visual reference

No change

@ltOgt
Copy link
Author

ltOgt commented Aug 17, 2024

Not sure why the formatter is still failing the pipeline

@ricardodalarme
Copy link
Owner

Thank you so much for your contribution! The CI failed because there is a lint issue, could you run dart format .?

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.

3 participants