Loading...
Loading...
Customize Riverpod automatic retry on provider failure; retry function, per-provider and global retry, disabling retry, ProviderException, awaiting retries. Use when a provider can fail transiently and should retry, or when you need to disable or customize retry logic. Use this skill when the user asks about retry, failed providers, or exponential backoff in Riverpod.
npx skill4agent add serverpod/skills-registry riverpod-retryDuration? Function(int retryCount, Object error)Duration? myRetry(int retryCount, Object error) {
if (retryCount >= 5) return null;
if (error is ProviderException) return null;
return Duration(milliseconds: 200 * (1 << retryCount));
}retry: myRetry@Riverpod(retry: myRetry)retry: myRetry// Global
ProviderScope(retry: myRetry, child: MyApp())
// Per provider (manual)
final myProvider = Provider<int>(retry: myRetry, (ref) => 0);ProviderScope(retry: (retryCount, error) => null, child: MyApp())ref.watch(myProvider.future)await ref.watch(myProvider.future)