rrousselGit / state_notifier

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

Add StateNotifierListener for create common widgets with no boilerplate code, no matter if provider or riverpod is used #64

Open MiniSuperDev opened 2 years ago

MiniSuperDev commented 2 years ago

It is useful to have a widget that is similar to bloc's BlocListener , to avoid boilerplate and dependencies on provider or riverpod.

Usually you use listen or watch or Consumer respectively from riverpod or provider.

But in some projects of my work we use provider and in others we are using riverpod, but we have some common StateNotifierss.

So in order to share widgets between projects regardless of whether we use provider or riverpod, we use a StateNotifierBuilder instead of watch or Consumer, but some widgets has some listeners with predefined behaviors, so we use a widget similar to this , that is a StateNotifierListener

Having the StateNotifierListener widget as part of flutter_state_notifier would be ideal, so you avoid having to create it yourself or use external packages.

robsonsilv4 commented 1 year ago

Hi @MiniSuperDev, I'm opened a PR adding StateNotifierListener and MultiNotifierListener (like in flutter_bloc).

CC: @furkanvatandas and @baumths