state_notifier icon indicating copy to clipboard operation
state_notifier copied to clipboard

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

Open MiniSuperDev opened this issue 2 years ago • 1 comments

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.

MiniSuperDev avatar May 22 '22 21:05 MiniSuperDev