-
-
Notifications
You must be signed in to change notification settings - Fork 956
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
Multiple ProviderListener #166
Comments
Another proposition for it could be : final listener1 = ProviderListener(
provider: provider1,
onChange: (context, value) {},
);
final listener2 = ProviderListener(
provider: provider2,
onChange: (context, value) {},
);
final listener3 = ProviderListener(
provider: provider3,
onChange: (context, value) {},
);
return MultipleListener(
listeners: [listener1, listener2, listener3], child: Container()); |
This issue may same as #163 |
Have a look at the hooks implementation Widget build(context) {
final fooState = useProvider(foo.state);
final barState= useProvider(bar.state);
final bazState = useProvider(baz.state);
return Container();
} |
Or why dont you just nest ProviderListeners? |
@quangson91 Thank you for pointing that out, I didn't see it. But yeah |
Closing in favor of #335 |
I am waiting for this feature. So, I am currently using this way. It's working for me.
@rrousselGit Hey, can you give me this way is okay or it is bad practice? |
ProviderListener is really good the only problem is that it only listen to one provider at time. my question is that would there be a solution for having a MultipleProviderListener where it listens to multiple provider and fires the
onchange
callback every-time one of these providers is changed.Example :
Is this a something that can be achieved ? and how is the performance going to be affected ?
Thank you again!
The text was updated successfully, but these errors were encountered: