waitingSyncTaskComplete function

FutureOr<void> waitingSyncTaskComplete(
  1. double contextId
)

Implementation

FutureOr<void> waitingSyncTaskComplete(double contextId) async {
  if (_workingCompleter != null) {
    return _workingCompleter!.future;
  }

  bool isBlocked = isJSThreadBlocked(contextId);
  if (isBlocked) {
    Completer completer = Completer();
    SchedulerBinding.instance.addPostFrameCallback((_) async {
      await waitingSyncTaskComplete(contextId);
      completer.complete();
    });
    SchedulerBinding.instance.scheduleFrame();
    return completer.future;
  }
}