Replies: 2 comments 1 reply
-
well you can achive your goal easily and riverpod provides you the tool but you need to do it in right way . @riverpod @OverRide void changeMyState (String newState){
} and then in your build method all you need to do is to invoke this function : \ ()=>ref.read(emailProvider.notifier).changeMyState(); I assume you are familiar with riverpod_generator and build_runner packages and already created .g.dart file . if not you need to go and read about it . |
Beta Was this translation helpful? Give feedback.
-
you don't need update(), just |
Beta Was this translation helpful? Give feedback.
-
I recently started using Riverpod. I generated a
NotifierProvider
withriverpod_generator
, but was surprised that I could not touch thestate
.Just to the point, the code above will produce the warning below in
state
.I know
StateProvider
will not produce such a warning. But ifStateProvider
is to be deprecated in the future, shouldn'tNotifierProvider
also be able to manipulate state directly?If I want to cover all providers with code generation, would the workaround be as follows?
Beta Was this translation helpful? Give feedback.
All reactions