resume method
void
resume()
Resume this query
Resuming a query will:
- Restart background refetch timers (if configured)
- Refetch data if stale (if refetchOnResume is enabled)
- Set fetchStatus to idle (so new fetches can happen)
This is called automatically when the app returns to foreground.
Implementation
void resume() {
if (fetchStatus.value == ZenQueryFetchStatus.paused) {
fetchStatus.value = ZenQueryFetchStatus.idle;
ZenLogger.logDebug('Query resumed: $queryKey');
update();
}
// Restart background refetch if configured
_setupBackgroundRefetch();
// Refetch if data is stale and refetchOnResume is enabled
if ((config.refetchOnResume) && isStale && enabled.value && !_isDisposed) {
fetch().then(
(_) {},
onError: (error, stackTrace) {
ZenLogger.logWarning(
'ZenQuery resume refetch failed for query: $queryKey',
);
},
);
}
ZenLogger.logDebug('Query resumed: $queryKey');
}