tryRefresh method

RxResult<void> tryRefresh()

Refresh with error handling

Implementation

RxResult<void> tryRefresh() {
  return RxResult.tryExecute(() {
    if (_futureFactory != null) {
      // If we have a factory, call it to create a new future
      _executeFuture();
    } else if (_currentFuture != null) {
      // If we only have a current future, restart it by setting loading and re-watching
      // Note: This won't actually re-execute the future logic, just reset the state
      value = const AsyncSnapshot.waiting();
      _watchFuture(_currentFuture!);
    } else {
      throw const RxException('No future or factory available to refresh');
    }
  }, 'refresh future');
}