rrousselGit / state_notifier

ValueNotifier, but outside Flutter and with some extra perks
MIT License
311 stars 28 forks source link

Add StateNotifierListener and MultiStateNotifierListener #73

Closed robsonsilv4 closed 1 year ago

robsonsilv4 commented 1 year ago

This PR closes #64 by adding StateNotifierListener and MultiStateNotifierListener*, based on BlocListener and MultiBlocListener from flutter_bloc (that uses Provider).

*MultiStateNotifierListener was also added, because solves the problem of nested StateNotifierListener.

Notes:

robsonsilv4 commented 1 year ago

Thanks to @felangel and all flutter_bloc contributors for the base code.

rrousselGit commented 1 year ago

Thanks for this!

It's pretty good so far, but I think the API should be a bit closer to how StateNotifier is typically used, instead of basing it off bloc.

As discussed above, could you remove listenWhen and have listener receive both the previous+current value?

rrousselGit commented 1 year ago

:wave:

Since this seems to be stale. I'll close this. Feel free to reopen a PR if you wish to continue working on it :)

robsonsilv4 commented 8 months ago

Hi @rrousselGit , thanks for the suggestions, and sorry for the delay. I was a little busy at the time Can you re-open the PR? I answered and update the implantation based on the comments Let me know if you want to modify something else :)