Loading...
Loading...
Compare original and translation side by side
Duration? 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));
}Duration? 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);retry: myRetry@Riverpod(retry: myRetry)retry: myRetry// 全局配置
ProviderScope(retry: myRetry, child: MyApp())
// 单个provider(手动定义)
final myProvider = Provider<int>(retry: myRetry, (ref) => 0);ProviderScope(retry: (retryCount, error) => null, child: MyApp())ProviderScope(retry: (retryCount, error) => null, child: MyApp())ref.watch(myProvider.future)await ref.watch(myProvider.future)ref.watch(myProvider.future)await ref.watch(myProvider.future)