settleAfterAction method

Future<void> settleAfterAction()

Implementation

Future<void> settleAfterAction() async {
  return RunnerBenchmark.async('execution', 'settleAfterAction', () async {
    try {
      await _settleUiFromEvents(timeout: config.actionSettleTimeout);
    } on FlutterError catch (error) {
      if (!error.toString().contains('timed out')) rethrow;
    }
    // A tap can launch an asynchronous app action (including navigation
    // callbacks that issue an API request first). Let that real async work
    // complete before the next step is evaluated, then settle its frames.
    // Keep this conditional so synchronous UI actions pay no extra wait.
    if (context.apiOverlay.hasPendingLiveCalls) {
      await yieldToLiveApiWork();
      try {
        await _settleUiFromEvents(timeout: config.actionSettleTimeout);
      } on FlutterError catch (error) {
        if (!error.toString().contains('timed out')) rethrow;
      }
    }
  });
}