Replies: 2 comments 3 replies
-
|
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.
Uh oh!
There was an error while loading. Please reload this page.
-
I recently started using Riverpod. I generated a
NotifierProviderwithriverpod_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
StateProviderwill not produce such a warning. But ifStateProvideris to be deprecated in the future, shouldn'tNotifierProvideralso 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