Why was AsyncValue.previous removed? #905
-
Is there another way to get AsyncValue.previous in a FutureProvider which was removed In this commit cb9ce91? final exampleProvider = FutureProvider.autoDispose<Example>(
(ref) async {
...
},
);
final otherExampleProvider = Provider.autoDispose<OtherExample>(
(ref) {
return ref.watch(exampleProvider).when(
data: ...,
error: ...,
loading: (data) { // data was available before the commit
final previous = data?.asData?.value;
...
},
);
},
);
ref.refresh(exampleProvider); |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
The reason I believe was that it interacted badly with custom uses of AsyncValue in StateNotifiers. Remi is trying to think of a better solution to this problem. |
Beta Was this translation helpful? Give feedback.
-
As Tim mentioned, this solution didn't scale well with provider variants. The syntax also wasn't ideal And I strongly believe that there is a much better solution lurking around. After the devtool, that's likely the next problem I will tackle, so you shouldn't have to wait too long |
Beta Was this translation helpful? Give feedback.
-
Is there any progress? |
Beta Was this translation helpful? Give feedback.
-
Also curious to see if there's a new solution for this. Like @NickBalnaves, I have a |
Beta Was this translation helpful? Give feedback.
As Tim mentioned, this solution didn't scale well with provider variants. The syntax also wasn't ideal
And I strongly believe that there is a much better solution lurking around. After the devtool, that's likely the next problem I will tackle, so you shouldn't have to wait too long