Open atulproject99 opened 1 week ago
I guess you are migrating to the new Notifier, and away from StateNotifier.
If so, check out my Discussion https://github.com/rrousselGit/riverpod/discussions/3836
The problem you are encountering is the following: The StateNotifier created a valid State in its Constructor. The new Notifier does create its first state with build(). In your case, calling 'build() -> fetchPost() -> state' does throw the current exception as you don't have a valid state, your build() method has not finished yet.
Describe the bug I have called fetchPost in build method but its give error like provider not initilized.if i add future.delay its working What is best way to call this method and how.
Sample code
Expected behavior It should not be showing error