handleAutoRefreshComputations method

void handleAutoRefreshComputations(
  1. dynamic event
)

Implementation

void handleAutoRefreshComputations(dynamic event) async {
  final appLifecycleBloc = FastAppLifecycleBloc.instance;
  final appLifecycleState = appLifecycleBloc.currentState.appLifeCycleState;

  if (appLifecycleState == AppLifecycleState.paused) return;

  if (await isCalculatorStateValid() &&
      isAutoRefreshCalculatorResultsEnabled()) {
    final canRefresh = await delegate?.canAutoRefreshComputations() ?? true;

    if (canRefresh) {
      debugLog('Auto-refreshing computations', debugLabel: debugLabel);
      addComputeEvent();
    }
  }
}