-
-
Notifications
You must be signed in to change notification settings - Fork 500
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
Remove listener doesn't remove the listener #679
Labels
question
Further information is requested
Comments
rrousselGit
added
question
Further information is requested
and removed
bug
Something isn't working
needs triage
labels
Sep 24, 2021
You cannot call |
@rrousselGit How do I deregister the listener then when the view is destroyed? |
You should keep a reference on the provided value inside your state MyModel? _myModel;
didChangeDependencies() {
super.didChangeDependencies();
_myModel = Provider.of<MyModel>();
}
dispose() {
_myModel!.removeListener();
} |
👋 |
josephnglynn
added a commit
to josephnglynn/Flexify
that referenced
this issue
Mar 9, 2024
=> rrousselGit/provider#679 shows how to do if you still want listeners
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am listening to a provider with
and removing it with
when I trigger the provider after my view was disposed it throws a null exception
The text was updated successfully, but these errors were encountered: