riverpod-pull-to-refresh
Installation
SKILL.md
Riverpod — Pull-to-refresh
Instructions
Riverpod fits pull-to-refresh well: refresh by invalidating the provider and let AsyncValue handle loading vs data vs error.
1. Provider and UI
Define an async provider (e.g. FutureProvider or AsyncNotifierProvider) that fetches data. Display it with ref.watch(provider) so you get an AsyncValue.
2. RefreshIndicator
Wrap your scrollable (ListView, SingleChildScrollView, etc.) in RefreshIndicator. In onRefresh, call ref.refresh(provider.future) so the indicator stays until the new data is loaded: