Loading...
Loading...
Implement pull-to-refresh with Riverpod using RefreshIndicator and ref.refresh; show spinner on initial load, show previous data during refresh, AsyncValue pattern matching. Use when the user asks about pull-to-refresh, RefreshIndicator with Riverpod, or refreshing async providers.
npx skill4agent add serverpod/skills-registry riverpod-pull-to-refreshRefreshIndicator(
onRefresh: () => ref.refresh(activityProvider.future),
child: ListView(
children: [
// content
],
),
)AsyncValue(:final value?)AsyncValue(:final error?)final activity = ref.watch(activityProvider);
switch (activity) {
AsyncValue<Activity>(:final value?) => Text(value.activity),
AsyncValue(:final error?) => Text('Error: $error'),
_ => const CircularProgressIndicator(),
}