Riverpod Migration to Notifier #3836
Unanswered
YukiAttano
asked this question in
Q&A
Replies: 1 comment 2 replies
-
You should be using AsyncNotifier here :) But you can use "stateOrNull" inside Notifier |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I may have misused Riverpod the whole time but i am now missing an important feature in the Notifier class which maybe someone might help me to avoid.
In short: i can't access a valid state during initialization (e.g. the first run of) build().
In long:
The following is a basic implementation of a Snapshot my Notifier are working with.
This is my StateNotifier, which is considered deprecated with the new Notifier Class
This is my approach in implementing the new Notifier, which will never work as i have to access the current 'state'.
The current state does not exist during initialization.
Up to now, from different workarounds, this one seems to be the most fitting (not yet tested) but doesn't feel right.
It would require me to write wrapper that either pass the Snapshot.init() for initialization or the current 'state' in all other cases.
Beta Was this translation helpful? Give feedback.
All reactions