Only show loading state on initial load of FutureProvider
#1011
Unanswered
peterhijma
asked this question in
Q&A
Replies: 1 comment
-
|
You can create your own Simple counter example:final counterProvider = StateNotifierProvider<Counter, AsyncValue<int>>((ref) {
return Counter();
});
class Counter extends StateNotifier<AsyncValue<int>> {
Counter() : super(const AsyncValue.loading()) {
increment();
}
int _count = 0;
Future<void> increment() async {
await Future.delayed(const Duration(milliseconds: 500));
state = AsyncValue.data(_count++);
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like to show the loading state only on the initial load of
FutureProvider. After using something like "swipe down to refresh" I'd like the list to remain visible and update if data is ready again.Anyone knows a non-hacky way to do this right now? Or a hacky way...
Beta Was this translation helpful? Give feedback.
All reactions