riverpod icon indicating copy to clipboard operation
riverpod copied to clipboard

Request to add update state method to Notifier

Open shashkiranr opened this issue 7 months ago • 4 comments

Is it possible to add updateState to Notifier just like it was present in StateProvider?

ref.read(provider.notifier).update((state) => state + 1);

Currently as per documentation the only way to get this is by adding the below to every Class Notifier. There are many Notifier<bool> that is used which will require the update function

  T update(T Function(T state) cb) => state = cb(state);

shashkiranr avatar Nov 13 '23 04:11 shashkiranr